I want load the lsbel lbl agreed amount from a value from database
my code is
public void Vehiclenocomboboxload()
{
OleDbConnection oleDbConnection1 = new System.Data.OleDb.OleDbConnection(connString);
oleDbConnection1.Open();
OleDbCommand oleDbCommand1 = new System.Data.OleDb.OleDbCommand("SELECT driverassignmastertable.drivername, driverassignmastertable.vehicleno, driverassignmastertable.amount, driverassignmastertable.driverpk FROM driverassignmastertable WHERE(((driverassignmastertable.jobcodepk)= @jobcodepk))", oleDbConnection1);
oleDbCommand1.Parameters.AddWithValue("@jobcodepk", cmbjobcode.SelectedValue);
OleDbDataReader reader = oleDbCommand1.ExecuteReader();
DataTable dt = new DataTable();
dt.Columns.Add("vehicleno", typeof(string));
dt.Columns.Add("drivername", typeof(string));
dt.Columns.Add("amount", typeof(int));
dt.Columns.Add("driverpk", typeof(int));
dt.Load(reader);
if (dt.Rows.Count == 0)
{
MessageBox.Show("No vehicle Assigned to this Jobcode");
cmbVehicleno.DataSource = null;
txtvehicleno.Text = "";
}
else
{
cmbVehicleno.ValueMember = "driverpk";
cmbVehicleno.DisplayMember = "vehicleno";
lblagreeamount.Text = "amount"
cmbVehicleno.DataSource = dt.DefaultView;
}
oleDbConnection1.Close();
}
all is fine but my problem is my lblagreed amount is not getting any value from database
my code part was
lblagreeamount.Text = “amount”
can anyone suggest any other databinding method
Just use this