CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: insert Issue

  1. #1
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Question insert Issue

    Why it is telling ???.the following issue .when i tried to run the following statement .in query analyzer. kindly let me know the idea .any help would be highly appreciated !!!!!!!!!!!.
    Server: Msg 170, Level 15, State 1, Line 1
    Line 1: Incorrect syntax near '00'.
    Code:
    insert into cnk_stores values (3609,029,'Monslpst023','Monsoon Salam plaza',2011-03-26 00:00:00)
    Attached Images Attached Images  

  2. #2
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: insert Issue

    Your date needs to be in single quotes.

  3. #3
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Question Re: insert Issue

    Your date needs to be in single quotes.
    Still the same .i got the same error
    Server: Msg 170, Level 15, State 1, Line 1
    Line 1: Incorrect syntax near '00'.

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: insert Issue

    The time AND THE DATE need quotes
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: insert Issue

    Quote Originally Posted by dglienna View Post
    The time AND THE DATE need quotes
    this ^^
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: insert Issue

    Spoon Feeding now......

    David's given you the answer ...

    try this code.....
    Code:
    insert into cnk_stores values (3609,029,'Monslpst023','Monsoon Salam plaza','2011-03-26 00:00:00')
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  7. #7
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Question Re: insert Issue

    why i am getting the following error ???.item cannot be found in the collection .
    Code:
     con.Execute "Insert into dbo.CNK_dailysales(Storeid,Saleserial,saleinternaldate,dumpdate,nettotal) values('" & rs!storeid & "','" & rs!saleserial & "','" & Format(rs!saleinternaldate, "YYYY-MM-DD") & "','" & Format(Now(), "YYYY-MM-DD HH:MM:SS") & "','" & rs!nettotal & "')"

  8. #8
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: insert Issue

    Well, Now, somewhere above in your code you are selecting data (rs). Since I don't have the code I would have to assume that "nettotal" is not in your select statement.

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