detox1978
asked on
c# .NET MSSQL: run stored procedure
Hi All,
What is the syntax to run a stored procedure in c#
Thanks
What is the syntax to run a stored procedure in c#
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry a little late as its the same link
ASKER
I've created a stored procedure and tested it works.
I've put together the code snipet below, but get the following error;
"Compiler Error Message: CS0161: 'FeedbackDataAccess.Create Feedback(s tring)': not all code paths return a value"
Any ideas?
I've put together the code snipet below, but get the following error;
"Compiler Error Message: CS0161: 'FeedbackDataAccess.Create
Any ideas?
protected void btnSubmit_Click(object sender, EventArgs e)
{
//first create the customer
FeedbackDataAccess.CreateFeedback(txtFeedback.Text);
}
public static int CreateFeedback(string myfeedback)
{
// get a configured DbCommand object
SqlCommand comm = GenericDataAccess.CreateCommand();
// set the stored procedure name
comm.CommandText = "App_AddFeedback";
// create a new parameter
SqlParameter param = comm.CreateParameter();
// declair variable(s) to pass to the stored procedure
param.ParameterName = "@myfeedback";
param.Value = myfeedback;
param.SqlDbType = SqlDbType.Text;
comm.Parameters.Add(param);
try
{
GenericDataAccess.ExecuteNonQuery(comm);
}
catch
{
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson07.aspx