using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace DoctorsInterface { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); builder.DataSource = "localhost"; builder.InitialCatalog = "SoundLakeHospitalAbt"; builder.PersistSecurityInfo = true; builder.UserID = txtUser.Text; builder.Password = txtPassword.Text; SqlConnection connect = new SqlConnection(builder.ToString()); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = connect; cmd.CommandText = "usp_PatientAppointments"; cmd.Parameters.Add("@DoctorID", SqlDbType.Int); cmd.Parameters.Add("@Date", SqlDbType.DateTime); cmd.Parameters["@DoctorID"].Value = 6; cmd.Parameters["@Date"].Value ="2/1/2009"; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); try { da.Fill(ds, "Appointments"); dataGridView1.DataSource = ds.Tables["Appointments"]; } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }