public void loadGrid() { string MediceneQuery = @"SELECT [medicine_ID],[medicine_Name],[medicine_Price], [Patient_ID] FROM [dbo].[Medicine]"; MediceneGridView.DataSource = db.getData(MediceneQuery); MediceneGridView.DataBind(); }
public void PopulateGridview() { DataTable dtbl = new DataTable(); using (SqlConnection sqlCon = new SqlConnection(connectionString)) { string UserQuery = @"SELECT [medicine_ID],[medicine_Name],[medicine_Price],[User_ID] FROM [dbo].[Medicine]"; sqlCon.Open(); SqlDataAdapter sqlDa = new SqlDataAdapter(UserQuery, sqlCon); sqlDa.Fill(dtbl); } if (dtbl.Rows.Count > 0) { MediceneGridView.DataSource = dtbl; MediceneGridView.DataBind(); } else { dtbl.Rows.Add(dtbl.NewRow()); MediceneGridView.DataSource = dtbl; MediceneGridView.DataBind(); MediceneGridView.Rows[0].Cells.Clear(); MediceneGridView.Rows[0].Cells.Add(new TableCell()); MediceneGridView.Rows[0].Cells[0].ColumnSpan = dtbl.Columns.Count; MediceneGridView.Rows[0].Cells[0].Text = "No Data Found ..!"; MediceneGridView.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; } }
public void loadGrid() { string UserQuery = @"SELECT [Patient_ID],[Patient_Name],[Patient_Mobile],[Patient_Address] FROM [dbo].[Patient]"; string DoctorQuery = @"SELECT [Doctor_ID],[Doctor_Name],[Doctor_Specialist],[Patient_ID] FROM [dbo].[Doctor]"; string MediceneQuery = @"SELECT [medicine_ID],[medicine_Name],[medicine_Price], [Patient_ID] FROM [dbo].[Medicine]"; string PrescriptionQuery = @"SELECT [Pers_ID] ,[Doctor_Name] ,[Date] ,[Patient_Name] ,[Age],[Blood_Pressure],[Pulse_Rate] ,[Patient_Problem] ,[Medicines] ,[Doctor_Advice] ,[Next_Date] FROM [dbo].[Prescription]"; PrescriptionGridView1.DataSource = db.getData(PrescriptionQuery); PrescriptionGridView1.DataBind(); UserGridView.DataSource = db.getData(UserQuery); UserGridView.DataBind(); DoctorGridView.DataSource = db.getData(DoctorQuery); DoctorGridView.DataBind(); MediceneGridView.DataSource = db.getData(MediceneQuery); MediceneGridView.DataBind(); }