Re: String was not recognized as a valid DateTime



Hi Herby,

You should really look into parametrised queries (instead of concatenating
sql commands you would pass values as parameters).
There is plenty of docs on the topic and you might start from .net help
file.
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Herby" <prmarjoram@xxxxxxxxx> wrote in message
news:1141129035.383857.188990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi im relatively new to both .NET and ADO.NET.
Im having a problem with dates when using SQL.

I have something like:
effective_date = '1/1/1990'

Iv then tried things like
effective_date = {ts '1990-01-01 00:00:00'}

Whatever i try i keep getting the following exception.

String was not recognized as a valid DateTime

Is there not some conversion routine, whereby if i give it some ad-hoc
string which represents a date in its many forms i.e. 1-1-1990, it will
return me the correct format to use in an SQL expression????

Thanks.



.



Relevant Pages

  • Re: Problems with Delete Command
    ... The SQL could get fairly messy if you need to construct it in code, ... ContactID, and WebComID, and create your on-the-fly SQL on that saved query, ... to find the list of ContactIDs from the junction table, ... This is a style/readability thing: if you are going to use string ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Need help with Code Please!!!
    ... posted in response to my last post was some SQL, but this is not the SQL that ... the actual string that gets built at the end of the SQ1 build process. ... The message says Syntax error in query expression ... Dim rs As Recordset 'object ref to qryCompany\USFNumber ...
    (microsoft.public.access.formscoding)
  • RE: Web Part and Access database
    ... I dont know if it is possible to connect to access,but you can download SQL ... Server Error in '/Webparts' Application. ... The connection string specifies a local Sql Server Express instance ... String user, String password, Boolean trusted, String connectionString) ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: INDEXES: BTRIEVE vs EXTFH (cobol)
    ... Bill Bach wrote: ... In SQL, you can specify just about anything, but at the lower MKDE ... the engine has to pick the right Btrieve ... When COBOL needs to find this value, it knows that the key is a string. ...
    (comp.databases.btrieve)
  • Re: INDEXES: BTRIEVE vs EXTFH (cobol)
    ... In SQL, you can specify just about anything, but at the lower MKDE ... the engine has to pick the right Btrieve ... When COBOL needs to find this value, it knows that the key is a string. ...
    (comp.databases.btrieve)