Jump to content

SQL syntax


dazza
 Share

Recommended Posts

$sqlCon = ObjCreate("ADODB.Connection")
$sqlCon.Open("Driver={SQL Server};Server=99.99.99.99;Database=inventory;Uid=id_name;Pwd=password;")
$RS=$sqlCon.EXECUTE("SELECT * FROM tblClass WHERE intClassTypeId = 125")

How do I put the results of the query into a string?

Many thanks.

Edited by dazza
Link to comment
Share on other sites

You have. $RS now equals the value of the query you executed.

ConsoleWrite($RS & @CRLF)

Put that beneath the query.

This is way off.

The Execute method returns a recordset object

While Not $RS.EOF
ConsoleWrite($RS.fields("column") & @CRLF);By column name
ConsoleWrite($RS.fields(0) & @CRLF);By index
$RS.MoveNext
WEnd
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...