Click to See Complete Forum and Search --> : Whats wrong with this SQL insert


scottie_uk
May 6th, 2003, 07:17 PM
Here it is:

INSERT INTO discountFile( productID, startDate, startTime, endTime, endDate, weekly, discount, BOGOF, TreeForTwo) VALUES ( " & prodId & ", #" & startDate & "#, '" & startTime & "', '" & endTime & "', #" & endDate & "#, '" & weekly & "', " & disc & ", " & bogof & ", " & tft & " );


Thanks for looking.
:(

hellomadhu
May 7th, 2003, 01:26 AM
whats the error msg u get ?

scottie_uk
May 7th, 2003, 10:06 AM
I have now found out it is to do with date formating.

Dim startDate As String = Format dtpAdjEdtDiscStartDate.Text, "dd,mm,yyyy")


This seems to return at string containing "DDMMYYYY" not a date.

I have tried using a date instead of a String but I get a invalid cast exeption.

Thanks for helping (once again).

scottie_uk
May 7th, 2003, 10:07 AM
sorry the code is:


Dim startDate As String = Format(dtpAdjEdtDiscStartDate.Text, "dd,mm,yyyy")


(last one was missing bracket.)

coolbiz
May 9th, 2003, 03:05 PM
Or you can format it like:
DateTime.Parse(dtpAdjEdtDiscStartDate.Text).ToString("MM/dd/yyyy")

-Cool Bizs