using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.SqlClient; using System.Windows.Forms; namespace Society_Management.Class.DataSet; { class DataBaseHelper { DatabaseConnection connection = new DatabaseConnection(); SqlCommand cmd; SqlDataReader reader; public List Chargestypes(string valueToSearch) { List charges = new List(); connection.OpenDBConnection(); string selectFromSqlDatatbase = "SELECT *FROM tbl_charges"; ChargesTypes charge;
connection.OpenDBConnection(); try { cmd = new SqlCommand(selectFromSqlDatatbase, connection.getDatabaseConnection()); reader = cmd.ExecuteReader();
while (reader.Read()) { charge = new ChargesTypes(); charge.SN = Convert.ToInt32(reader[0].ToString()); charge.From = reader[1].ToString(); charge.To = reader[2].ToString(); charge.TYPEOFCHARGES = reader[3].ToString(); charge.VALUEofCHARGES = Convert.ToInt32(reader[4].ToString()); charge.REM1 = reader[5].ToString(); charge.REM2 = Convert.ToInt32(reader[6].ToString());
charges.Add(charge); } } catch (Exception ex) { MessageBox.Show("Error" + ex); } finally { connection.CloseDBConnection(); } return charges; }
class Expenditures { DatabaseConnection connection = new DatabaseConnection(); SqlCommand cmd; SqlDataReader reader;
public List expenditures (string valueToSearch) { List Expend = new List(); connection.OpenDBConnection(); string selectFromSqlDatatbase = "SELECT *FROM tbl_expenditure";
Expenditures expn; try { cmd = new SqlCommand(selectFromSqlDatatbase, connection.getDatabaseConnection()); reader = cmd.ExecuteReader();
while (reader.Read()) { expn = new Expenditures(); expn.SN = Convert.ToInt32(reader[0].ToString()); expn.CHARGES = reader[1].ToString(); Here expn.VALUEofCHARGES = Convert.ToInt32(reader[0].ToString());
Expend.Add(expn);
} }
catch(Exception ex) { MessageBox.Show("Error" + ex); } finally { connection.CloseDBConnection();
} return Expend;
}
Attachment: Desktop.rar