Sign in to follow this  
Followers 0
dazza

SQL syntax

3 posts in this topic

#1 ·  Posted (edited)

$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

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0