![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Could not find Stored Procedure error in VB script Hi Guys I have the following VBS script, I get Could not find Stored Procedure on the Execute line below. When I examine the strSQLQuery data it contains "select * from people where userid = 'js36'" (with quotes). It falls over too if I run it in QA with the quotes too. How can I get this to work? Thanks ' on error resume next ' if it's Monday then open the phonebook. Values are S(1), M(2),T(3), W(4), T(5), F(6), S(7). if (weekday(Date)) = 4 then 'get the login ID for the user set net= CreateObject("wscript.network") myLoginID=net.username myLoginID ="'" & myLoginID & "'" ' build a SQL query and pass the login name to it strSQLQuery = "SELECT * FROM PEOPLE WHERE USERID = " & myLoginID strSQLQuery = """" & strSQLQuery & """" wscript.echo strSQLQuery ' connect to the database Set objCN = CreateObject("ADODB.Connection") strConnection = "Driver={SQL Native Client};Server=SQL12;Database=phonebookproddb;Trusted_Connection=yes;" objCN.Open strConnection ' execute the query Set objRS=CreateObject("ADODB.Recordset") Set objRS=objCN.Execute(strSQLQuery) ' open IE and call the phonebook at the logged-in user's page Set ie = CreateObject("InternetExplorer.Application") iePath = "http://intranet3/phonebook/Changes/MyDetails.asp?type=P&personid=" & objRS("Personid") ie.Navigate iePath Do Until counter > 1000000 or Not ie.Busy counter = counter + 1 Loop with ie.document.parentwindow .moveto 0,0 .resizeto .screen.availWidth, .screen.availHeight end with ie.menubar = true ie.toolbar = true ie.visible = true end if |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Could not find Stored Procedure error in VB script axapta wrote: Quote: > Hi Guys I have the following VBS script, I get Could not find Stored > Procedure on the Execute line below. > When I examine the strSQLQuery data it contains "select * from people > where > userid = 'js36'" (with quotes). It falls over too if I run it in QA with > the quotes too. How can I get this to work? > > Thanks > > ' on error resume next > > ' if it's Monday then open the phonebook. Values are S(1), M(2),T(3), > W(4), > T(5), F(6), S(7). > if (weekday(Date)) = 4 then > > 'get the login ID for the user > set net= CreateObject("wscript.network") > myLoginID=net.username > myLoginID ="'" & myLoginID & "'" > > ' build a SQL query and pass the login name to it > strSQLQuery = "SELECT * FROM PEOPLE WHERE USERID = " & myLoginID > strSQLQuery = """" & strSQLQuery & """" > > wscript.echo strSQLQuery > > ' connect to the database > Set objCN = CreateObject("ADODB.Connection") > strConnection = "Driver={SQL Native > Client};Server=SQL12;Database=phonebookproddb;Trusted_Connection=yes;" > > objCN.Open strConnection > > ' execute the query > Set objRS=CreateObject("ADODB.Recordset") > > > Set objRS=objCN.Execute(strSQLQuery) > > > ' open IE and call the phonebook at the logged-in user's page > Set ie = CreateObject("InternetExplorer.Application") > iePath = > "http://intranet3/phonebook/Changes/MyDetails.asp?type=P&personid=" > & objRS("Personid") > ie.Navigate iePath > Do Until counter > 1000000 or Not ie.Busy > counter = counter + 1 > Loop > with ie.document.parentwindow > .moveto 0,0 > .resizeto .screen.availWidth, .screen.availHeight > end with > ie.menubar = true > ie.toolbar = true > ie.visible = true > end if > > would remove the following statement: strSQLQuery = """" & strSQLQuery & """" I believe ADO assumed the expression in quotes was the name of a stored procedure. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Streamreader and BCP vs SqlConnection and a Stored Procedure | PowerShell | |||
| VB script - for accessing a array returned from stored procedure | VB Script | |||
| executing sql stored procedure | VB Script | |||
| Calling a stored procedure from powershell | PowerShell | |||
| Executing Stored Procedure from Powershell | PowerShell | |||