PC Review


Reply
Thread Tools Rate Thread

Cant get Stored Procedure connection string right??

 
 
=?Utf-8?B?aGVtYW50?=
Guest
Posts: n/a
 
      28th Jan 2005
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

 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      28th Jan 2005
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" <(E-Mail Removed)> wrote in message
news:46BCBE1F-82DA-4971-A17A-(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
=?Utf-8?B?aGVtYW50?=
Guest
Posts: n/a
 
      28th Jan 2005
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



"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" <(E-Mail Removed)> wrote in message
> news:46BCBE1F-82DA-4971-A17A-(E-Mail Removed)...
> > 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
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse string from C# to stored procedure Wing Siu Microsoft C# .NET 4 8th Nov 2006 06:11 AM
How to pass stored procedure as string to another method? Assimalyst Microsoft C# .NET 3 8th Aug 2006 03:03 PM
Connection String to SQL to run Stored Procedure Carl Microsoft Excel Programming 2 10th Nov 2005 12:49 PM
Stored Procedure and SQL String???? =?Utf-8?B?VGltOjouLg==?= Microsoft ASP .NET 5 1st Mar 2005 07:49 PM
Stored Procedure as String and rowsource Carol Williams Microsoft Access ADP SQL Server 1 25th Sep 2003 06:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:15 PM.