narasiman rao

narasiman rao

  • NA
  • 519
  • 768.4k

date to be saved in the format of date month in data base.

Jan 14 2013 11:15 PM
Saving the record into data base from data grid view.in that date to be saved in the format of date month in data base.

code as follows;

 sql = "insert into Tb_SCh_TIme_Table(Date,Session,Course,Faculty_Code)" + " values ('" + Convert.ToDateTime(datagridView.Rows[i].Cells[0].Value.ToString()) + "', '" + int.Parse(datagridView.Rows[i].Cells[1].Value.ToString()) + "', '" + datagridView[j, i].Value.ToString() + "','" + datagridView.Columns[j].HeaderText.ToString() + "')";

through the above query it is saving to the data base.

in database Date is stored in the format such as 1/7/2013 12:00:00 AM.

but i want the the date to be stored in the format of 1 jan only.

the above format of date and month(Month to be character format)

Convert.ToDateTime(datagridView.Rows[i].Cells[0].Value.ToString()


Saving the record into database from data grid view using csharp


from the above query how to do.

output as follows;

Date
1 jan
8 jan
3 Feb

like that to be saved in the data base.

how to do.please help me.

Answers (2)