Jump to content
Sign in to follow this  
dazza

SQL syntax

Recommended Posts

dazza

$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
weaponx

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  

×