Reputation: 1
I'm trying to have a DataGridView in my Windows Forms showing data from the database, but it doesn't want to run.
namespace DentalClinicManagementSystem
{
class MyPatient
{
public void AddPatient(string query)
{
ConnectionString MyConnection = new ConnectionString();
SqlConnection Con = MyConnection.GetCon();
SqlCommand cmd = new SqlCommand();
cmd.Connection = Con;
Con.Open();
cmd.CommandText = query;
cmd.ExecuteNonQuery();
Con.Close();
}
public DataSet ShowPatient(string query)
{
ConnectionString MyConnection = new ConnectionString();
SqlConnection Con = MyConnection.GetCon();
SqlCommand cmd = new SqlCommand();
cmd.Connection = Con;
cmd.CommandText = query;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
return ds;
}
}
}
Upvotes: 0
Views: 76