Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


SQL error in vbs. help me to solve

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61591
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> SQL error in vbs. help me to solve
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 SQL error in vbs. help me to solve - 6/18/2008 3:16:55 PM   
  aru1683

 

Posts: 25
Score: 0
Joined: 7/1/2007
From: India
Status: offline
Hi All,
I am using the following script to check some count of work in the db. But this script was giving me an error type mismatch. i think the error is at rows=connection.execute(IME).
this connection.execute returns the count of the work. so help me what should be done to make this work.?


-----------------------------------------------------------------------------------------------------------------------
Option Explicit

Const IME = "select count (*) from work where name = 'working'"
Dim connectionString
connectionString = "DRIVER={SQL Server};SERVER=cpsrimp;UID=lSuper;PWD=getMeIn;DATABASE=logical"

Dim connection: Set connection = CreateObject("ADODB.Connection")
Dim rows: Set rows = CreateObject("ADODB.Recordset")
'* Create objects
'* Open connection
connection.Open connectionString
'* Execute SQL
rows = connection.Execute(IME)
msgbox rows
set connection = nothing
------------------------------------------------------------------------------------------------------------------------------

error :
C:\Documents and Settings\Desktop\dbs.vbs(18, 1) Microsoft VBScript runt
ime error: Wrong number of arguments or invalid property assignment
 
 
Post #: 1
 
 RE: SQL error in vbs. help me to solve - 6/18/2008 3:22:13 PM   
  dm_4ever


Posts: 2665
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
More than likely the problem is with this line

msgbox rows
oh...and maybe Set

maybe try....

Option Explicit

Const IME = "select count (*) AS [Working Count] from work where name = 'working'"
Dim connectionString
connectionString = "DRIVER={SQL Server};SERVER=cpsrimp;UID=lSuper;PWD=getMeIn;DATABASE=logical"

Dim connection: Set connection = CreateObject("ADODB.Connection")
Dim rows: Set rows = CreateObject("ADODB.Recordset")
'* Create objects
'* Open connection
connection.Open connectionString
'* Execute SQL
Set rows = connection.Execute(IME)
msgbox rows.fields.item("Working Count").value

< Message edited by dm_4ever -- 6/18/2008 3:42:52 PM >


_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to aru1683)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> SQL error in vbs. help me to solve Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts