0

I am trying to populate textbox on winsows application from database.

The stored procedure pulls data using datareader. Data looks fine when I execute stored procedure on SQL server management studio.

But when I am trying to populate from the application its not getting same result.

I apprecaite all help.

Thanks

txtovrts.Text = dr["lst_mod_dt"].ToString();
// returns date only

 txtovrts.Text = Convert.ToDateTime(ds["lst_mod_dt"].ToString("MM/dd/yyyy hh:mm:ss");
 //returns correct date but time stamp is always returned as 12:00:00(which is incorrect)
2
Contributors
2
Replies
16
Views
1 Year
Discussion Span
Last Post by mpdph09
1

Is it possible that the actual datetime value in the database has 00:00:00.000 for the time portion? I tried this with my SQL database and it worked as you wanted. The first time I got 09/14/1994 00:00:00 and my database value was 09/14/1994 00:00:00.000. When I manually set the database value to 09/14/1994 09:17:23.000 then that was the value displayed when I ran the code.

0

Thansk for response. I have different values in the databse table, its just conversion part seems to be issue in my application. I also cecked executing stored procedure it returns same value as in the table for that particular coulmn.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.