Dear Friends,
How do you use Select stored procedure(to display data in the windows application) and Update stored procedure ( to update data through windows application UI)? I learnt Insert stored procedure from your replys.
Thanks in advance.........
Bechir BejaouiRank #144 · 15.9K pointsPosted Apr 8, 2008, 2:10 AM EDT
Dinusha Gamage47 pointsPosted Apr 8, 2008, 2:59 AM EDT
Dear Friend,
Thanks for that reply, and I run that coding which has given below........ But there is an error coming
//Error : The SqlParameterCollection only accepts non-null SqlParameter type objects.
Parameter name: value
So, How do you provide the @Cust_code(this is the customer code you want to invoke from the table) in the Coding
CREATE PROCEDURE usp_GetCustomer
@Cust_code char(8)
as
SELECT cust_code, cust_name FROM CM_CUSTHED
WHERE cust_code=@Cust_code
GO
// as above I defined the SQL S-procedure.
And then write the code below :
private void btnView_Click(object sender, EventArgs e)
{
SqlConnection s = new SqlConnection(connectionstring);
s.Open();
SqlCommand cmd = new SqlCommand("usp_GetCustomer", s);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter para = new SqlParameter("@Cust_code",System.Data.SqlDbType.Char);
//In the given below coding how do you provide the customer code to filter and dispaly it in the widows application???????????
cmd.Parameters.Add(para.Value);
}