Okay, so try this:
Code:
SQLInsert = "SET DATEFORMAT DMY; " _
& "INSERT INTO Transac_Table (TransNumber, Date_Received,Quantity, Amount)" _
& "VALUES ('" & TCode & "', '" & CurDate & "', '" _
& txtQuantity.Text & "', '" & txtAmount.Text & "')"
That tells SQL Server that you want to use the format dd/mm/yyyy for the date. By default, SQL Server uses USA standard, mm/dd/yyyy.
BUT...
But this has *NOTHING* to do with "parameterized queries"!!
In fact, this is the opposite of a parameterized query; it's an
AD HOC query.
On top of everything, this kind of query is the *MOST* susceptible to SQL Injection.
So you *REALLY* should be doing SQL Injection protection!
Also, I see other *probable* problems in there. You have apostrophes around the value of TCode
...('" & TCode & "',...
Yet the field in the DB is named Trans
Number. If it's truly a number, kill those apostrophes. And SURELY that is also true about fields named
Quantity and
Amount. SURELY those are also numbers, no???
SO *GUESSING* at what you need...and it really is a guess...
Code:
SQLInsert = "SET DATEFORMAT DMY; " _
& "INSERT INTO Transac_Table (TransNumber, Date_Received,Quantity, Amount)" _
& "VALUES (" & CLNG(TCode) & ", '" & CurDate & "', " _
& CDBL(txtQuantity.Text) & "," & CDBL(txtAmount.Text) & ")"
The calls to CLNG and CDBL in there are to *ENSURE* that nobody has managed to slip in SQL Injection to those form fields (may not be needed for TCode...can't tell).
If this still doesn't work, then use
MsgBox SQLInsert
to see *exactly* what the query is that you are using and show that to us.