CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Location
    Cardiff and Oxford
    Posts
    44

    Whats wrong with this SQL insert

    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.

  2. #2
    Join Date
    Jan 2001
    Location
    India
    Posts
    228
    whats the error msg u get ?
    regards
    madhu

  3. #3
    Join Date
    Mar 2003
    Location
    Cardiff and Oxford
    Posts
    44
    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).

  4. #4
    Join Date
    Mar 2003
    Location
    Cardiff and Oxford
    Posts
    44
    sorry the code is:


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


    (last one was missing bracket.)

  5. #5
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167
    Or you can format it like:
    DateTime.Parse(dtpAdjEdtDiscStartDate.Text).ToString("MM/dd/yyyy")

    -Cool Bizs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured