hello

Monday, 22 October 2012

How Call StoredProcedure in c#


        con = new SqlConnection("Data Source=122;Initial Catalog=test;Integrated Security=True");
        con.Open();
        cmd = new SqlCommand("GetLoginDetail", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = txtUserName.Text;
        cmd.Parameters.Add("@Password", SqlDbType.VarChar).Value = txtPassword.Text;
        cmd.Parameters.Add("@inst_id", SqlDbType.VarChar).Value = ddlinsti.SelectedValue;

        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = cmd;
        DataSet ds = new DataSet();
        da.Fill(ds);
        con.Close();

No comments:

Post a Comment