public DataTable GetData() { DataTable aDataTable = new DataTable(); string query = "SELECT *FROM tbl_treatment"; ASqlCommand = new SqlCommand(query, ASqlConnection); SqlDataAdapter aSqlDataAdapter = new SqlDataAdapter(); ASqlCommand.CommandType = CommandType.Text; try { ASqlConnection.Open(); aSqlDataAdapter.SelectCommand = ASqlCommand; aSqlDataAdapter.Fill(aDataTable); return(aDataTable); } catch (Exception aException) { throw aException; } finally { ASqlConnection.Close(); aSqlDataAdapter.Dispose(); ASqlConnection.Dispose(); } }
public DataTable GetData(long voterId) { DataTable aDataTable = new DataTable(); string query = "SELECT * FROM v_patient_history WHERE voter_id = '" + voterId + "'"; ASqlCommand = new SqlCommand(query, ASqlConnection); SqlDataAdapter aSqlDataAdapter = new SqlDataAdapter(); ASqlCommand.CommandType = CommandType.Text; try { ASqlConnection.Open(); aSqlDataAdapter.SelectCommand = ASqlCommand; aSqlDataAdapter.Fill(aDataTable); return(aDataTable); } catch (Exception aException) { throw aException; } finally { ASqlConnection.Close(); aSqlDataAdapter.Dispose(); ASqlConnection.Dispose(); } }
public DataTable GetData(string name) { DataTable aDataTable = new DataTable(); string query = "SELECT *FROM View_History where patient='" + name + "';"; ASqlCommand = new SqlCommand(query, ASqlConnection); SqlDataAdapter aSqlDataAdapter = new SqlDataAdapter(); ASqlCommand.CommandType = CommandType.Text; try { ASqlConnection.Open(); aSqlDataAdapter.SelectCommand = ASqlCommand; aSqlDataAdapter.Fill(aDataTable); return(aDataTable); } catch (Exception aException) { throw aException; } finally { ASqlConnection.Close(); aSqlDataAdapter.Dispose(); ASqlConnection.Dispose(); } }