Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 mssql and vb.net

Author  Topic 

glda19
Starting Member

3 Posts

Posted - 2015-05-03 : 16:12:51
I
On my form in vb i have a textbox and give the date as follow 15/06/2008
But i think mssql need it as so 2008/06/15
Who can i convert ?

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2015-05-03 : 16:53:41
Columns in Sql server tables that represent dates should be some flavor of date datatype. Your vb form should convert the textbox.text value to a date typed variable(using something like Date.tryParse or Date.tryParseExact and send that to sql server.

Be One with the Optimizer
TG
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2015-05-04 : 03:52:57
quote:
Originally posted by glda19


But i think mssql need it as so 2008/06/15



The ONLY non-ambiguous date format that SQL will take is "yyyymmdd" - i.e. with no punctuation.

If you pass the date from the APP using a native [i.e. VB] date datatype then it should be fine. If you are creating a String of SQL to execute then you need to manipulate the date string to "yyyymmdd"
Go to Top of Page
   

- Advertisement -