C#.NET SQL :'CommandType' does not exist in the current context

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mnarewec
    New Member
    • Nov 2007
    • 22

    C#.NET SQL :'CommandType' does not exist in the current context

    I got a compile error here !

    using System;
    using System.Data.Sql Client;
    using System.Data.Sql ;
    using System.Collecti ons.Generic;
    using System.Text;

    namespace PacSoft
    class clsUDC
    {
    //clsADO objADO;
    //SqlCommand cmd;
    //SqlConnection cnn;

    void AddUDC(string sys, string type, string code, string desc)
    {
    try
    {
    clsADO objADO = new clsADO();
    SqlConnection cnn = new SqlConnection(o bjADO.Connectio nString);
    cnn.Open();
    SqlCommand cmd = new SqlCommand("pr_ tblUDC_Insert", cnn);
    cmd.CommandType = CommandType.Sto reProcedure;
    }
    catch (Exception e)
    {
    Console.WriteLi ne(e.Message);
    }

    WHERE did I go wrong ??
    Please assist . Marsh
  • mrlister
    New Member
    • Nov 2007
    • 2

    #2
    try using the following:

    Using System.Data;

    Comment

    • mnarewec
      New Member
      • Nov 2007
      • 22

      #3
      Originally posted by mrlister
      try using the following:

      Using System.Data;
      Thanks so much mrlister. It works.

      Comment

      • Danish Backer

        #4
        :) Thankyou!

        Comment

        Working...