|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Cant get Stored Procedure connection string right??Hi,
SqlCommand cmd = new SqlCommand("my_storedprocedure",con); cmd.CommandType = CommandType.StoredProcedure; The error is : type or namespace name 'CommandType' could not be found(are you missing a using directive or an assembly reference) I have included the following namespaces using System.Data.SqlClient; and the method 'CommandType 'is defined in this class only, but still i could not get it right. Suggest some other work arounds, or get it right. Please advise -- Hemant Singh Software Programmer You need to import System.Data, I believe that is where that enumeration is,
since it is not exclusive to SQL Server. In general, you could always find what namespace a class is in, by looking it up in the documentation. Show quoteHide quote "hemant" <hem***@discussions.microsoft.com> wrote in message news:46BCBE1F-82DA-4971-A17A-52098EC8B13C@microsoft.com... > Hi, > SqlCommand cmd = new SqlCommand("my_storedprocedure",con); > cmd.CommandType = CommandType.StoredProcedure; > > The error is : type or namespace name 'CommandType' could not be found(are > you missing a using directive or an assembly reference) > > I have included the following namespaces > using System.Data.SqlClient; > and the method 'CommandType 'is defined in this class only, but still i > could not get it right. > > Suggest some other work arounds, or get it right. > > Please advise > -- > Hemant Singh > Software Programmer > Hi Marina,
Thanks for the reply. I got it working, I am using MS .NET 2003 and i dont have to specify commandtype to change it to storedprocedure, I ommitted the line and voila it worked. The compiler is smart enough to make adjustments. Do correct me if i'm wrong. Thanks again Hemant Singh Show quoteHide quote "Marina" wrote: > You need to import System.Data, I believe that is where that enumeration is, > since it is not exclusive to SQL Server. > > In general, you could always find what namespace a class is in, by looking > it up in the documentation. > > "hemant" <hem***@discussions.microsoft.com> wrote in message > news:46BCBE1F-82DA-4971-A17A-52098EC8B13C@microsoft.com... > > Hi, > > SqlCommand cmd = new SqlCommand("my_storedprocedure",con); > > cmd.CommandType = CommandType.StoredProcedure; > > > > The error is : type or namespace name 'CommandType' could not be found(are > > you missing a using directive or an assembly reference) > > > > I have included the following namespaces > > using System.Data.SqlClient; > > and the method 'CommandType 'is defined in this class only, but still i > > could not get it right. > > > > Suggest some other work arounds, or get it right. > > > > Please advise > > -- > > Hemant Singh > > Software Programmer > > > > >
Other interesting topics
Data reader already open?
Question about SQLDataReader infoMessage Truncated # of pooled connections seem too high OleDbParameter doesn't update value correctly What is the Best way to fetch the most recent updated row in a database Question on how I can use ForeignKeyConstraint Dataset created in Code cannot be used in Crystal Reports designer RowState Confused about MissingSchemaAction.AddWithKey |
|||||||||||||||||||||||