VBGuy
Oct 7th, 2005, 08:41 AM
Actually, I understand the message, I don't see what the problem is. the error is:
"The type or namespace name 'cmd' could not be found (are you missing a using directive or an assembly reference?)"
Here is the code:
static private void LogError (int AppID)
{
SqlConnection cn;
SqlCommand cmd;
SqlParameter parm;
cn = new SqlConnection();
cn.ConnectionString = ConnectionString;
cmd.CommandType = CommandType.StoredProcedure;
cmd = new SqlCommand("uspInsertErrorLog",cn);
parm = new SqlParameter("@ApplicationCode",SqlDbType.SmallInt);
parm.Value = AppID;
cmd.Parameters.Add parm;
cn.Open();
cmd.ExecuteNonQuery();
}
The error is on the line:
cmd.Parameters.Add parm;
and it refers to the cmd reference. What am I not seeing?
Thanks
RESOLUTION:
I am missing the parens around the 'parm'
the line should be cmd.Paramters.Add (parm);
Added green "resolved" checkmark - Hack
"The type or namespace name 'cmd' could not be found (are you missing a using directive or an assembly reference?)"
Here is the code:
static private void LogError (int AppID)
{
SqlConnection cn;
SqlCommand cmd;
SqlParameter parm;
cn = new SqlConnection();
cn.ConnectionString = ConnectionString;
cmd.CommandType = CommandType.StoredProcedure;
cmd = new SqlCommand("uspInsertErrorLog",cn);
parm = new SqlParameter("@ApplicationCode",SqlDbType.SmallInt);
parm.Value = AppID;
cmd.Parameters.Add parm;
cn.Open();
cmd.ExecuteNonQuery();
}
The error is on the line:
cmd.Parameters.Add parm;
and it refers to the cmd reference. What am I not seeing?
Thanks
RESOLUTION:
I am missing the parens around the 'parm'
the line should be cmd.Paramters.Add (parm);
Added green "resolved" checkmark - Hack