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.
|