473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Problems with doing an SQL insert stored procedure

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.
Nov 19 '05 #1
4 937
Make sure that System.Data is imported...my guess is that you only have
System.Data.SqlClient or System.data.OleDbClient

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"EmJayEm" <Wo*@eookie.com> wrote in message
news:Z9******************@fe3.news.blueyonder.co.u k...
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.

Nov 19 '05 #2
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

"EmJayEm" <Wo*@eookie.com> wrote in message
news:Z9******************@fe3.news.blueyonder.co.u k...
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.

Nov 19 '05 #3
Hmm... should work. Try using the full namespace.
How is cmd declared?

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"EmJayEm" <Wo*@eookie.com> wrote in message
news:Z9******************@fe3.news.blueyonder.co.u k...
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.

Nov 19 '05 #4
Cheers guys for replying.

I didn't have the System.Data namespace
EmJ.
"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:ut****************@TK2MSFTNGP10.phx.gbl...
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

"EmJayEm" <Wo*@eookie.com> wrote in message
news:Z9******************@fe3.news.blueyonder.co.u k...
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.


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Markku Uttula | last post by:
I think I'm doing something wrong. I'm able to connect to Oracle just fine, execute queries and all, but I'm having serious problems with the speed :( For example, the following PHP-script on my...
3
by: bigDWK | last post by:
Hi- I'm having problems with the following stored procedure. Below first I have the stored proc, then I have the asp code that calls it. Randomly it won't insert the order into the database and a...
5
by: me | last post by:
I'm also having problems getting the bulk insert to work. I don't know anything about it except what I've gleened from BOL but I'm not seeming to get anywhere...Hopefully there is some little (or...
6
by: CJM | last post by:
I've created a Stored Procedure which adds a new record and updates some more records and then returns the primary key for the added record. The SP seems to work OK, but I'm having problems...
2
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have...
1
by: Chad Dittmer via .NET 247 | last post by:
I'm having problems inserting into Sql 2000 using SqlHelper.ExecuteScalar. When it inserts, it only takes the first character from the string?? Any help would be appreciated. Here is the code and...
4
by: JC - home | last post by:
Hello.. I've been having some problems for a little while with this which I was sure I would beat...hmmm. Anyway, I have a form with two rich textboxes. One at the top which is to display a...
2
by: Thomas Beyerlein | last post by:
I am building a UI, I am using stored procedures for executing SQL commands on the server. When I ran a insert stored procedure it returned me a error message that it could not find a parameter...
5
by: Bogdan | last post by:
Hi, I have a stored procedure that uses JOINs to return columns from multiple tables. I also have another stored proc that that takes a series of params and updates multiple tables. I used the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.