exception; object reference not set to an instance of an object

E

Eric Sabine

very easy I'm sure...

On the return statement, I get the object reference not set to an instance
of an object exception. I fully typed out the object paths for clarity,
i.e., the application blocks and the configuration settings.

thank, Eric


private int LogTransfer(string FileName, string Email, string UserName,
int Direction)
{
// Set up our 4 parameters
SqlParameter[] arParms = new SqlParameter[4];
arParms[0] = new SqlParameter("@filename", SqlDbType.VarChar, 200 );
arParms[0].Value = FileName;
arParms[1] = new SqlParameter("@email", SqlDbType.VarChar, 200);
arParms[1].Value=Email;
arParms[2] = new SqlParameter("@ssiuser", SqlDbType.VarChar, 200);
arParms[2].Value=UserName;
arParms[3] = new SqlParameter("@type", SqlDbType.SmallInt );
arParms[3].Value= Direction;

return (int)Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(

System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString
"),
CommandType.StoredProcedure,
"webdata.dbo.usp_di_webFileTransferLog",
arParms);
}
 
E

Eric Sabine

Thank you, I did not mention it but I also tried replacing the
AppSettings.Get() method with the connection string itself. The exception
did not stop.

Eric


You'll get the exception if your AppSettings files doesn't have an
entry for "ConnectionString"... --> Case sensitive and spelled
correctly else null is returned...

--Richard

Eric Sabine said:
very easy I'm sure...

On the return statement, I get the object reference not set to an
instance of an object exception. I fully typed out the object paths
for clarity, i.e., the application blocks and the configuration
settings.

thank, Eric


private int LogTransfer(string FileName, string Email, string
UserName, int Direction)
{
// Set up our 4 parameters
SqlParameter[] arParms = new SqlParameter[4];
arParms[0] = new SqlParameter("@filename", SqlDbType.VarChar, 200
); arParms[0].Value = FileName;
arParms[1] = new SqlParameter("@email", SqlDbType.VarChar, 200);
arParms[1].Value=Email;
arParms[2] = new SqlParameter("@ssiuser", SqlDbType.VarChar, 200);
arParms[2].Value=UserName;
arParms[3] = new SqlParameter("@type", SqlDbType.SmallInt );
arParms[3].Value= Direction;

return
(int)Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(

System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString
"),
CommandType.StoredProcedure,
"webdata.dbo.usp_di_webFileTransferLog",
arParms);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top