|
|
 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|

April 28th, 2004, 06:31 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Location: Portsmouth, Hampshire, United Kingdom.
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Stored Procedures
Hiya Guys,
I am using System.Data.SqlClient for the first time and wrote this code to create a stored procedure but I keep getting this error: -
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
This is my code: -
SqlConnection objConnection;
string strSQL;
SqlCommand objCommand;
objConnection = new SqlConnection("Data Source=(local)\\NetSDK; Initial Catalog=NorthWind; Integrated Security = true");
objConnection.Open();
strSQL = "CREATE PROCEDURE sp_WaCustomers AS SELECT CustomerID, CustomerName FROM Customers WHERE Region = 'WA'";
objCommand = new SqlCommand(strSQL, objConnection);
objCommand.CommandType = CommandType.StoredProcedure;
objCommand.ExecuteNonQuery();
Console.WriteLine("Procedure Created !!");
Any ideas??
Adz - The World is not enough
__________________
Adz - Learning The J2EE Ways.
|

April 29th, 2004, 12:47 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Tehran, Iran
Posts: 922
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Dear friend:
ur command (strSQL) is not wrong but I think u get this error bc of 3 reason.
1_ I see no user & pass in ur Connection string to connect user(objConnection).
2_ Ensure u r going to execute the command for not first time & SP is already created.
3_ U might have no primission to create SP on server.
START FROM #1.
HTH, Keep in touch.
Always:),
Hovik Melkomian.
|

April 29th, 2004, 04:31 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Location: Portsmouth, Hampshire, United Kingdom.
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What should the connection string be if the SQL Database using the windows authentication as user name and password??
Adz - The World is not enough
|

April 29th, 2004, 05:01 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Location: Portsmouth, Hampshire, United Kingdom.
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I have changed my connection string, but I am still getting the same error??
this is my code: -
SqlConnection objConnection;
string strSQL;
SqlCommand objCommand;
objConnection = new SqlConnection("Data Source=(local)\\NetSDK; Initial Catalog=NorthWind; uid=QSUser; pwd=QSPassword; Integrated Security=SSPI");
objConnection.Open();
strSQL = "CREATE PROCEDURE sp_WaCustomers AS SELECT CustomerID, CustomerName FROM Customers WHERE Region = 'WA'";
//strSQL = "SELECT * FROM CustomerID";
objCommand = new SqlCommand(strSQL, objConnection);
objCommand.CommandType = CommandType.StoredProcedure;
objCommand.ExecuteNonQuery();
Console.WriteLine("Procedure Created !!");
Any Ideas??
Adz - The World is not enough
|

May 1st, 2004, 03:40 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Tehran, Iran
Posts: 922
Thanks: 0
Thanked 1 Time in 1 Post
|
|
dear freind:
u r creating SP not using SP so ur comand is Test & u should set ur CommandType to
Code:
objCommand.CommandType = CommandType.Text;
HTH.
Always:),
Hovik Melkomian.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |