please help
i get this error when calling the ExecuteDataset method
in SQLHelper.cs, can anyone tell me what it could be? i
am lost here...
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and
where it originated in the code.
Exception Details: System.InvalidCastException: Object
must implement IConvertible.
Source Error:
Line 342:
Line 343: //fill the DataSet using
default values for DataTable names, etc.
Line 344: da.Fill(ds);
Line 345:
Line 346: // detach the
SqlParameters from the command object, so they can be
used again.
Source File:
c:\inetpub\wwwroot\buereu\components\sqlhelper.cs
Line: 344
my code that calls the SQLHelper.cs looks like this
public static SimpleReportCollection GetMTCDR(string
SystemID, string Addr)
{
SqlParameter [] arParms = new
SqlParameter[2];
arParms[0] = new SqlParameter
("@SystemID", SqlDbType.VarChar,25);
arParms[0].Value = SystemID;
arParms[1] = new SqlParameter
("@Addr", SqlDbType.VarChar,25);
arParms[1].Value = Addr;
DataSet dsData =
SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings
["ConnectionString1"], "GetAdminCDR", arParms);
SimpleReportCollection items =
new SimpleReportCollection();
foreach(DataRow row in
dsData.Tables[0].Rows)
{
SimpleReport item = new
SimpleReport();
item.sourceAddr = row
["sourceAddr"].ToString();
item.destinationAddr = row
["destinationAddr"].ToString();
item.payload = row
["payloadsection"].ToString();
if (row
["twistSubmitDateTime"] != DBNull.Value)
{
item.submitDatetime = row
["twistSubmitDateTime"].ToString();
}
else
{
item.submitDatetime = "NULL";
}
if (row["drDateTime"] !=
DBNull.Value)
{
item.deliveryDatetime = row["drDateTime"].ToString
();
}
else
{
item.deliveryDatetime = "NULL";
}
item.status = row
["status"].ToString();
items.Add(item);
}
return items;
}
Thanks :)
"nana" <ringti...@webmail.co.za> wrote in message
news:01ff01c2f849$283ca7c0$3001...@phx.gbl...
>.
>
'wrong - leaves out the connection parameter:
Return ExecuteReader(CommandType.StoredProcedure, spName,
commandParameters)
'right:
Return ExecuteReader(connection,
CommandType.StoredProcedure, spName, commandParameters)
FYI, unit testing with NUnit helped me find this bug. I
let MS know about it, but I don't think they fixed it.
>.
>
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
SqlParameter[] arrparams = new SqlParameter[2];
arrparams[0] = new SqlParameter("@pwd",pwd);
arrparams[1] = new SqlParameter("@id",id);
object o = SqlHelper.ExecuteScalar(ConnectionString.cnn, "Pwd_Verificar", arrparams);
i get the IConvertible error of the subject, BTW if i change the code to this:
object[] arrparams = new object[2];
arrparams[0] = (string) pwd;
arrparams[1] = (int) id;
object o = SqlHelper.ExecuteScalar(ConnectionString.cnn, "Pwd_Verificar", arrparams);
But in the DAAB documentation says the correct way is the first... , any help will be appreciated