Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Passing arguments to TO_CHAR via OLE provider

Passing arguments to TO_CHAR via OLE provider

Passing arguments to TO_CHAR via OLE provider

Hi All

Any help greatfully received.

Need to use TO_CHAR function but I cant get the ole provider
to pass the double quotes needed for the TO_CHAR arguments.

The error returns "Column (%d/%m/%y %T) not found in any table in the query (or SLV is undefined)."

the sql works fine using SQL editor/studio, etc but not when passed via OLE


Option Explicit

Dim cn, rc,strDSN,sql1
Set cn = CreateObject("ADODB.Connection")
Set rc =   CreateObject("ADODB.Recordset")
strDSN = "Provider=Ifxoledbc.2;Password=Password;Persist Security Info=True;" _
& "User ID=UserName;Data Source=dbname@ol_server;Extended Properties=""DB_LOCALE=en_us.819""


sql1 = "SELECT first 10 TO_CHAR(evtime,""%d/%m/%y %T"") from log"

WScript.Echo sql1
'SQL echoed out works when pasted in to SQL Editor, etc.

rc.Open sql1, cn,3,3
WScript.Echo Err.Number & " _ " & Err.Description

Set cn=Nothing
Set rc = Nothing
Set sql1 = Nothing
Set strDSN = Nothing

RE: Passing arguments to TO_CHAR via OLE provider

Thanks all who may have looked at this. Just worked this out - used single quote!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close