Conversion failed when converting date and/or time from character string.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello Every1
i am using this query top get the data from sql server 2008 server
<pre class="prettyprint" style="font-size:12px using (cmd = new SqlCommand("SELECT * FROM InterestTransactions WHERE RecId="+RecId+"AND PostDt="+DateTime.Today+"",con))[/code]
but getting the Error Conversion failed when converting date and/or time from character string.
This code runs on one machine perfectly where data time is mm/dd/yyyy and do not run on another machine where date time is dd/mm/yyyy.
Please,tell how to run this query on any machine? or at least on dd/mm/yyyy

View the full article
 
Back
Top