Calling a procedure

  • Thread starter Thread starter Jon Cosby
  • Start date Start date
J

Jon Cosby

How do you call an existing procedure? My database has a procedure called
"StudentSchedule" with one parameter, @StudentID. I'm trying to fill the
results in a datagrid with a StoredProcedure command. The grid is not even
showing on the page.

SqlCommand cmdSchedule = new SqlCommand(, this.cnBCC);
cmdSchedule.CommandType = CommandType.StoredProcedure;

SqlParameter studID = cmdSchedule.Parameters.Add("@StudentID",
SqlDbType.NChar, 9);
studID.Value = this.tbSID.Text.Trim();

SqlDataAdapter daSchedule = new SqlDataAdapter(cmdSchedule);
DataSet ds = new DataSet();

daSchedule.Fill(ds);
this.dgStudents.DataSource = ds;


Jon Cosby
 
Back
Top