Problems with doing an SQL insert stored procedure

E

EmJayEm

I'm having some problems with this line when I do a SQL insert stored
procedure:

Compiler Error Message: BC30451: Name 'CommandType' is not declared.

Source Error:


Line 65: cmd.Parameters.Add( "@EmployeeID", newEmployeeId)
Line 66:
Line 67: cmd.CommandType = CommandType.StoredProcedure
Line 68:
Line 69: conn.Open()


Any ideas anyone?

Thanks,

EmJ.
 
M

Mark Fitzpatrick

Assuming that you imported the System.Data.SqlClient, System.Data.OleDb, or
another namespace to connect to the DB, did you also import the System.Data
namespace? I've seen it happen a couple times where the
System.Data.SqlClient namespace (or whatever is appropriate for the given
database) is imported since all the connection and command objects, but the
System.Data namespace is forgotten. You have to import the System.Data
namespace in order to use the CommandType because it lives in the
System.Data namespace as System.Data.CommandType.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
K

Karl Seguin

Make sure that System.Data is imported...my guess is that you only have
System.Data.SqlClient or System.data.OleDbClient

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top