I am trying to select my column no.ofTrips
in my tbl_bill_addtrips
but when everytime i click the button, OK. the Unknown column 'no.ofTrips
' in 'fieldlist' appear.
this is my sample code
try
{
string MyConSs = "SERVER=localhost;" +
"DATABASE=prototype_db;" +
"UID=root;";
MySqlConnection conns = new MySqlConnection(MyConSs);
MySqlCommand comms = conns.CreateCommand();
MySqlDataAdapter da = new MySqlDataAdapter();
comms.CommandText = "Select no.ofTrips FROM tbl_bill_addtrips WHERE RouteFrom = '" + this.txtBillRouteFrom.Text + "' and RouteTo ='" + txtBillRouteTo.Text + "'";
MySqlDataReader Readers;
conns.Open();
Readers = comms.ExecuteReader();
while (Readers.Read())
{
txtNoOfTrips.Text = Readers.GetValue(0).ToString();
}
Readers.Close();
conns.Close();
}
catch (Exception error)
{
MessageBox.Show(error.ToString());
}
please help me thanks in advance