I
Ivan
Hi all,
i have been trying this for 7 hrs now !!!
How do you call a adodb.command object in .net(c#)
code******
ADODB.Connection cn = new ADODB.ConnectionClass();
ADODB.Command cm = new ADODB.CommandClass();
ADODB.Parameter pa = new ADODB.ParameterClass();
ADODB.Recordset rs = new ADODB.RecordsetClass();
object rc;
cn.Provider="SQLOLEDB.1";
cn.Open(ConfigurationSettings.AppSettings["sqlServerConnection"].ToString(),"","",-1);
cm.ActiveConnection=cn;
cm.CommandType=ADODB.CommandTypeEnum.adCmdStoredProc;
cm.CommandText="sp_rptRegister";
pa=cm.CreateParameter("@Id",ADODB.DataTypeEnum.adInteger,ADODB.ParameterDirectionEnum.adParamInput,0,506);
cm.Parameters.Append(pa);
object par= cm.Parameters;
rs=cm.Execute(out rc,ref
par,(int)ADODB.CommandTypeEnum.adCmdStoredProc);
sXML=rs.Fields[0].Value.ToString();
code******
The last line gives an error that it is BOF AND EOF (when there are
records!)
(it give the field names but not the records, i suspect the parameter
value is not getting passed to the sp (and yes i have tried passing
the value pa[0].value=506 in a seperate statement))
I have tried using the CommandText="sp_rptRegister 506" and it works
but i need to use the para collection.
Please Please somebody help me.....i need a solution by tonite
Thanks in advance
Ivan
i have been trying this for 7 hrs now !!!
How do you call a adodb.command object in .net(c#)
code******
ADODB.Connection cn = new ADODB.ConnectionClass();
ADODB.Command cm = new ADODB.CommandClass();
ADODB.Parameter pa = new ADODB.ParameterClass();
ADODB.Recordset rs = new ADODB.RecordsetClass();
object rc;
cn.Provider="SQLOLEDB.1";
cn.Open(ConfigurationSettings.AppSettings["sqlServerConnection"].ToString(),"","",-1);
cm.ActiveConnection=cn;
cm.CommandType=ADODB.CommandTypeEnum.adCmdStoredProc;
cm.CommandText="sp_rptRegister";
pa=cm.CreateParameter("@Id",ADODB.DataTypeEnum.adInteger,ADODB.ParameterDirectionEnum.adParamInput,0,506);
cm.Parameters.Append(pa);
object par= cm.Parameters;
rs=cm.Execute(out rc,ref
par,(int)ADODB.CommandTypeEnum.adCmdStoredProc);
sXML=rs.Fields[0].Value.ToString();
code******
The last line gives an error that it is BOF AND EOF (when there are
records!)
(it give the field names but not the records, i suspect the parameter
value is not getting passed to the sp (and yes i have tried passing
the value pa[0].value=506 in a seperate statement))
I have tried using the CommandText="sp_rptRegister 506" and it works
but i need to use the para collection.
Please Please somebody help me.....i need a solution by tonite
Thanks in advance
Ivan