Hi Friends,
I need to fetech some datafrom DB2 and paste in SQL. I am able to do that but some problem in date format.
Date format in DB2 is like
2003-09-23 12:32:09.095499
but when i insert into sql its became
9/23/2003 12:32:09 PM
actually my DB2 field is a string not a date. but sql converts it into date
i am feteching data from DB2 with help of dataset and datatable. In the dataset itself dateconversion occur.
How can i solve this
My SQL quey for feteching data from DB2
SELECT KEY_TMS, CAT_TRDCTL, DT2_BILL, CAT_BILL, DT2_FROM, KEY_ACCT, DT2_ME, AMT_MKTVAL FROM TBL_BILL
this is how i am passing value to sql
cmd.Parameters.Add("@KEY_TMS", SqlDbType.VarChar).Value =dt.Rows[i]["KEY_TMS"].ToString();
Edited***
As per suggestion i made date formating
but millisecond portion is not working as expected
keytms_date = Convert.ToDateTime(dt.Rows[i]["KEY_TMS"].ToString());
cmd.Parameters.Add("@KEY_TMS", SqlDbType.VarChar).Value = keytms_date.ToString("yyyy-MM-dd hh:mm:ss.ffffff");
its showing 000000 insted of 095499
how can i solve this issue