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

Thread: sql convert function

Hybrid View

  1. #1
    Join Date
    Sep 2001

    sql convert function


    I used convert function in sql server with no problem, but when i try to use in in vb6 for my quiry it does not recognize the convert function

    rst.open "Select * from mytable where docdate=" & convert(datetime,vDate, 102)

    this suppose to filter the rst with docdate= vdate only

    note that , docdate(datetime,null)

    this gives an error :
    compile error:
    Sub or Function not Defined

    I am not sure now if the CONVERT function of sql server is supported in VB6


  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: sql convert function

    If the function is part of your SQL string then it must be part of the sql string. Here you have placed it outside your quotes so VB is looking for a function named convert within your program rather than passing it on as part of the query.

    rst.open "Select * from mytable where docdate= convert(datetime, " & vDate &", 102)"
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Sep 2001

    Re: sql convert function

    its working fine now,,, thank you very much

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)