ASP.NET - exception cannot convert string to datetime in C# application

Asked By anbu n on 19-Mar-11 06:18 AM
i have written a procedure where input parameters are two varchar data type ... in those i am passing date or else i may pass empty strings ... in procedure this works fine even if i pass empty string for input parameters ,

but through asp.net application while i pass empty string to the above procedure it throws an exception where input string cannot be converted into datetime.

Datetime cannot be convert in c# eventhough it s working fine in sql
Reena Jain replied to anbu n on 19-Mar-11 06:20 AM
hi,

In place of blank just pass null to the @parameter and then try the code.

Hope this will help you
Sahil Kumar replied to anbu n on 19-Mar-11 06:29 AM
Hi,
    Send NULL parameter to your application I think it should work....
Kirtan Patel replied to anbu n on 19-Mar-11 08:36 AM
u said that u have varchar data type as column type then it should not create any problem . double check the data type of column in database because error points that u have date time type set as column :)

hope this helps :)
anbu n replied to Kirtan Patel on 20-Mar-11 09:52 PM
only parameter is varchar datatype... but coloumn is datetime