Error
-
hi i have developed my application in vb.net2005 & inbuilt crystal report. i have taken one maskeditbox with 'shortdatetime' data type & in database - sql server2005 there is also datatype is 'datetime'.but after executing application following error occured - error - unable to cast object of type 'system.string' to type 'system.IFormatProvider' my namespaces are - imports system.data imports system.data.client sql_str = " insert into abc(mdate2,itemcode)(select mdate2,itemcode from xyz where mdate2 = " & " " & convert.date(me.maskedbox1.text) & " )" my stored date format is 'dd/MM/yyyy' with time 00:00:00. but i do not want this time.what i do ? plz. help me. i want only date in dd/MM/yyyy format without time and datatype 'datetime' using maskeditbox . how can i do calculation on date suggest me code with sample.
Thanks bye
-
hi i have developed my application in vb.net2005 & inbuilt crystal report. i have taken one maskeditbox with 'shortdatetime' data type & in database - sql server2005 there is also datatype is 'datetime'.but after executing application following error occured - error - unable to cast object of type 'system.string' to type 'system.IFormatProvider' my namespaces are - imports system.data imports system.data.client sql_str = " insert into abc(mdate2,itemcode)(select mdate2,itemcode from xyz where mdate2 = " & " " & convert.date(me.maskedbox1.text) & " )" my stored date format is 'dd/MM/yyyy' with time 00:00:00. but i do not want this time.what i do ? plz. help me. i want only date in dd/MM/yyyy format without time and datatype 'datetime' using maskeditbox . how can i do calculation on date suggest me code with sample.
Thanks bye
You know if you used parameterised queries you wouldn't have to worry about converting date formats and you would improve the security between your application and the database at the same time as you reduce the possibility of SQL Injection Attacks. Please read SQL Injection Attacks and Tips on How To Prevent Them[^]
Upcoming FREE developer events: * Developer! Developer! Developer! 6 * Developer Day Scotland My website