Results 1 to 2 of 2

Thread: [RESOLVED] Dont understand error message

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    Resolved [RESOLVED] Dont understand error message

    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:

    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
    Last edited by Hack; Oct 7th, 2005 at 12:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width