con.open();
SqlCommamd comm = new SqlCommand("Insert into Debt_Tab values('"+Textbox1.text+"')",con);
comm.ExecuteNonQuery();
Textbox1 I is declared as a DateTime
in my Sql table.
con.open();
SqlCommamd comm = new SqlCommand("Insert into Debt_Tab values('"+Textbox1.text+"')",con);
comm.ExecuteNonQuery();
Textbox1 I is declared as a DateTime
in my Sql table.
4
Answers
Try this:-
example:-
There are a lot of different ways to format a date. To be sure that the database gets the correct format I suggest that you parse the date by specifying a culture.
For desktop applications, this is easy since the OS is configured for a specific format, while for web applications the user uses their own preferred format (unless you have specified something else).
To parse using the OS culture:
To parse using a specific culture:
Another thing. There is something seriously wrong with your code. It’s vulnerable to SQL injection attacks. You need to use a parameterized query instead.
use this hope this will work
Try the following way to validate the date