Insert only time in sql table from c# -


i have windows application have used date time pickers shift start , shift end. have insert timings table. code :

if (combobox1.selectedindex == 0 || combobox1.selectedindex == 1 || combobox1.selectedindex == 2 || combobox1.selectedindex == 3 || combobox1.selectedindex == 4 || combobox1.selectedindex == 5 || combobox1.selectedindex == 6 || combobox1.selectedindex == 7 || combobox1.selectedindex == 8 || combobox1.selectedindex == 9 || combobox1.selectedindex == 10 || combobox1.selectedindex == 11 || combobox1.selectedindex == 12 || combobox1.selectedindex == 13 || combobox1.selectedindex == 14 || combobox1.selectedindex == 15 || combobox1.selectedindex == 16) {     string query = " insert [icps].[dbo].[cau reports]( [name],[date],[shift start],[shift end ],[overtime start],[overtime end],[tasks carried out],[normal ],[overtime],[normal 1],[overtime1],[comments],[targets_(per hour)]) values ('" + this.textbox1.text + "','" + this.date.text + "', convert(varchar(5),'" + this.ss.text + "',108), '" + this.se.text + "','" + this.os.text + "','" + this.oe.text + "','" + this.combobox1.selectedtext + "','" + this.nt.text + "','" + this.ot.text + "','" + this.textbox2.text + "','" + this.textbox3.text + "','" + this.textbox4.text + "','" + this.textbox5.text + "' ) ;";      // string query = " update [icps].[dbo].[cau reports] set  [normal]='" + this.textbox7.text + "',[overtime]='" + this.textbox8.text + "',[normal 1]='" + this.textbox2.text + "',[overtime1]='" + this.textbox3.text + "',[comments]='" + this.textbox4.text + "',[targets_(per hour)]='" + this.textbox5.text + "'where  [tasks carried out] ='" + this.combobox1.selectedtext + "'; ";      sqlconnection condatabase = new sqlconnection(constring);     sqlcommand cmddatabase = new sqlcommand(query, condatabase);     sqldatareader myreader;      try     {         condatabase.open();         myreader = cmddatabase.executereader();         messagebox.show("saved");          while (myreader.read())         {         }     }     catch (exception ex)     {         messagebox.show(ex.message);     } } 

but output comes : 01/01/1900 16:36 (i don't need date in shift start , shift end time). appreciated.please...

ensure using appropriate sql server time type data column.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -