ALTER Procedure [dbo].[Select_Students](@Sno int) As Begin If @Sno Is Null Select Sno,Sname,Class,Fees From Stu Else Select Sname,Class,Fees From Stu Where Sno=@Sno End
private void button1_Click(object sender, EventArgs e) { cmd.Parameters.Clear(); ds = new DataSet(); da = new SqlDataAdapter(); cmd.CommandText = "Select_Students"; da.Fill(ds, "Stu"); if (ds.Tables[0].Rows.Count > 0) { textBox2.Text = ds.Tables[0].Rows[0][1].ToString(); textBox3.Text = ds.Tables[0].Rows[0][2].ToString(); textBox4.Text = ds.Tables[0].Rows[0][3].ToString(); } else MessageBox.Show("Record Not Existed"); }
ds = new DataSet(); da = new DataAdapter(cmd); da.Fill(ds, "Stu");
da = new SqlDataAdapter(cmd);
//After creating SqlCommand object and adding parameters to it ds = new DataSet(); da = new DataAdapter(cmd); da.Fill(ds, "Stu");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)