Jagjit Saini

Jagjit Saini

  • NA
  • 166
  • 0

Typecasting Problem

Sep 5 2011 2:54 AM
HI


datetime _dt;
  string ConnectionStr = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;
  MySqlDataAdapter da = new MySqlDataAdapter("select curdate(),curtime()", ConnectionStr);
  DataTable dt = new DataTable();
  da.Fill(dt);
  _dt = (DateTime)dt.Rows[0][0];
  label5.Text = _dt.ToString("dd/MM/yyyy");
  _dt = (DateTime)dt.Rows[0][1];  (Error : specified cast is not valid)

Thanks

Answers (6)