Jump to content

HElp with query in Sql server


Recommended Posts

Hi, I have a problem inside a query with sql server. When i execute and i success with data then all right. When the query have no data has result my project crash. I use this code:

$conn = ObjCreate("ADODB.Connection")

$DSN = "DRIVER={SQL Server};" & "SERVER=XX.XX.XX.XX\SQLEXPRESS;DATABASE=Test;UID=SA;PWD=password;"

$rs = ObjCreate("ADODB.RecordSet")

$conn.Open($DSN)

$rs=$conn.EXECUTE("SELECT * from table where ....")

if $rs.RecordCount<>0 Then

MsgBox(1,"Found",$rs.Fields("value").Value)

EndIf

$rs.close

$conn.close

error is:

The requested action with this object has failed.:

$hQuery = $hConHandle.Execute($vQuery)

$hQuery = $hConHandle.Execute($vQuery)^ ERROR

thanks and sorry for my english

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...