Hi guys! can any one help me to know how we can execute stored procedures of SQL server in .net
executing Stroed procedures using .net
Collapse
X
-
Tags: None
-
Hi,Originally posted by cvraghavan1979Hi guys! can any one help me to know how we can execute stored procedures of SQL server in .net
The above is an example of executing stored procedure in .net. In the above code,"procUpdat ePDetails" is the stored procedure.Code:sqlConRowUpdate = new SqlConnection(strConnectionString); sqlConRowUpdate.Open(); SqlCommand SqlCmdRowUpdate = new SqlCommand(); SqlCmdRowUpdate.Connection = sqlConRowUpdate; SqlCmdRowUpdate.CommandText = "procUpdatePDetails"; SqlCmdRowUpdate.CommandType = CommandType.StoredProcedure; SqlCmdRowUpdate.Parameters.Add("@purchaseid", SqlDbType.VarChar).Value = strPurchaseId; SqlCmdRowUpdate.Parameters.Add("@productname", SqlDbType.VarChar).Value = strProductNameNew; SqlCmdRowUpdate.Parameters.Add("@noofitems", SqlDbType.Int).Value = intNoOfItems; SqlCmdRowUpdate.Parameters.Add("@priceperunit", SqlDbType.Int).Value = intPricePerUnit; SqlCmdRowUpdate.ExecuteNonQuery();
Regards,
Mathew. -
hi,
thank u mathew. i got an idea of using the stored procedures through the example given by you. thank u for ur timely help. looking forward for a good team work with u and other team members. Have A Nice Day!
regards,
vijayComment
Comment