RE: [U2] UVODBC procedure call from VBScript
Hi, Mr. Jordan. I've been considering using ODBC instead of UniObjects for our web project, too, but am unfamiliar with . Could you please include a small, very generic, code snippet to show what you mean here. It would be much appreciated! Thanks, Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of OZEMAIL Sent: Tuesday, July 26, 2005 6:21 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] UVODBC procedure call from VBScript To return a recordset from a UniBasic subroutine to an ODBC call you need to load data into the @HSTMT variable in the UniVerse Basic Subroutine. Regards David Jordan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 27 July 2005 6:31 AM To: u2-users@listserver.u2ug.org Subject: [U2] UVODBC procedure call from VBScript Hi all, I'm trying to convert a web app from Sybase to UV. I've been attempting to get a vbscript app to call a subroutine as a stored procedure. I am able to connect to the database using the OLE provider and retrieve recordsets. I'd like to be able to execute stored procs as well. IBM provided me with a VB sample to call a subroutine but I can't seem to implement it in VBScript. I've gone over the docs a million and one times and still can't seem to see what I'm missing. Does anyone have any samples, calling a subroutine through ODBC that would return a rescordset to the script that they would be able to share ? Thanks for any help, Vance Forste --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] UVODBC procedure call from VBScript
I don't have a problem retreiving record sets. Actually calling the procedure is what I'm having a problem with. The procedure calls fail with an error of not a valid SQL command when I use a statement like sql = {CALL LIST VOC} or in my case I'd like it to be a subroutine but this is something like one of the sample from the docs. Well if I get an answer I'll pass it along Vance Hi, Mr. Jordan. I've been considering using ODBC instead of UniObjects for our web project, too, but am unfamiliar with . Could you please include a small, very generic, code snippet to show what you mean here. It would be much appreciated! Thanks, Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of OZEMAIL Sent: Tuesday, July 26, 2005 6:21 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] UVODBC procedure call from VBScript To return a recordset from a UniBasic subroutine to an ODBC call you need to load data into the @HSTMT variable in the UniVerse Basic Subroutine. Regards David Jordan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 27 July 2005 6:31 AM To: u2-users@listserver.u2ug.org Subject: [U2] UVODBC procedure call from VBScript Hi all, I'm trying to convert a web app from Sybase to UV. I've been attempting to get a vbscript app to call a subroutine as a stored procedure. I am able to connect to the database using the OLE provider and retrieve recordsets. I'd like to be able to execute stored procs as well. IBM provided me with a VB sample to call a subroutine but I can't seem to implement it in VBScript. I've gone over the docs a million and one times and still can't seem to see what I'm missing. Does anyone have any samples, calling a subroutine through ODBC that would return a rescordset to the script that they would be able to share ? Thanks for any help, Vance Forste --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] UVODBC procedure call from VBScript
Dave: AFAIR this is documented in the less-than-obvious location of the UCI Guide. Here is a quick example using local UniVerse SQL in a subroutine as a stored procedure. I've used this with OleDB though not with ODBC, using the SQL CALL statement. NOTE that if you are using ODBC, I've found that {NATIVE} queries are very much quicker that regular ODBC queries. Check out the syntax for the NATIVE statement in the uvodbc guide. GetOrdersForCustomer 0001 SUBROUTINE( CustNo ) 0002 $Include UNIVERSE.INCLUDE ODBC.H 0003 0004 TCL = SELECT * FROM ORDERS WHERE CUSTNO = : CustNo 0005 T = SQLExecDirect(@HSTMT, TCL) 0006 RETURN Brian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Tabor Sent: 27 July 2005 13:14 To: u2-users@listserver.u2ug.org Subject: RE: [U2] UVODBC procedure call from VBScript Hi, Mr. Jordan. I've been considering using ODBC instead of UniObjects for our web project, too, but am unfamiliar with . Could you please include a small, very generic, code snippet to show what you mean here. It would be much appreciated! Thanks, Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of OZEMAIL Sent: Tuesday, July 26, 2005 6:21 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] UVODBC procedure call from VBScript To return a recordset from a UniBasic subroutine to an ODBC call you need to load data into the @HSTMT variable in the UniVerse Basic Subroutine. Regards David Jordan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 27 July 2005 6:31 AM To: u2-users@listserver.u2ug.org Subject: [U2] UVODBC procedure call from VBScript Hi all, I'm trying to convert a web app from Sybase to UV. I've been attempting to get a vbscript app to call a subroutine as a stored procedure. I am able to connect to the database using the OLE provider and retrieve recordsets. I'd like to be able to execute stored procs as well. IBM provided me with a VB sample to call a subroutine but I can't seem to implement it in VBScript. I've gone over the docs a million and one times and still can't seem to see what I'm missing. Does anyone have any samples, calling a subroutine through ODBC that would return a rescordset to the script that they would be able to share ? Thanks for any help, Vance Forste --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] UVODBC procedure call from VBScript
Brian, This is exactly what I wantto do. However the VBScript syntax is where I'm getting stuck. How do I set the arguments... I know with uvobj sub calls you need to set the parameter values for the routine. I'm assuming the same is true here. But this is what I have : dim cnn set cnn = Server.CreateObject(ADODB.Connection) cnn.Provider = IBM.UniOLEDB.1 dim dns dsn = DATA SOURCE=localuv;LOCATION=test;USER ID=test;PASSWORD=test; cnn.Open(dsn) dim rs, sql set rs = server.createobject(adodb.recordset) txtSubroutine = MYSUB SQL = {CALL txtSubroutine } rc = cnn.Execute (SQL) but my sub has arguments that need to be passed. I'm sure I'm looking right at the answer and looking right over it. Vance Dave: AFAIR this is documented in the less-than-obvious location of the UCI Guide. Here is a quick example using local UniVerse SQL in a subroutine as a stored procedure. I've used this with OleDB though not with ODBC, using the SQL CALL statement. NOTE that if you are using ODBC, I've found that {NATIVE} queries are very much quicker that regular ODBC queries. Check out the syntax for the NATIVE statement in the uvodbc guide. GetOrdersForCustomer 0001 SUBROUTINE( CustNo ) 0002 $Include UNIVERSE.INCLUDE ODBC.H 0003 0004 TCL = SELECT * FROM ORDERS WHERE CUSTNO = : CustNo 0005 T = SQLExecDirect(@HSTMT, TCL) 0006 RETURN Brian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Tabor Sent: 27 July 2005 13:14 To: u2-users@listserver.u2ug.org Subject: RE: [U2] UVODBC procedure call from VBScript Hi, Mr. Jordan. I've been considering using ODBC instead of UniObjects for our web project, too, but am unfamiliar with . Could you please include a small, very generic, code snippet to show what you mean here. It would be much appreciated! Thanks, Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of OZEMAIL Sent: Tuesday, July 26, 2005 6:21 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] UVODBC procedure call from VBScript To return a recordset from a UniBasic subroutine to an ODBC call you need to load data into the @HSTMT variable in the UniVerse Basic Subroutine. Regards David Jordan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 27 July 2005 6:31 AM To: u2-users@listserver.u2ug.org Subject: [U2] UVODBC procedure call from VBScript Hi all, I'm trying to convert a web app from Sybase to UV. I've been attempting to get a vbscript app to call a subroutine as a stored procedure. I am able to connect to the database using the OLE provider and retrieve recordsets. I'd like to be able to execute stored procs as well. IBM provided me with a VB sample to call a subroutine but I can't seem to implement it in VBScript. I've gone over the docs a million and one times and still can't seem to see what I'm missing. Does anyone have any samples, calling a subroutine through ODBC that would return a rescordset to the script that they would be able to share ? Thanks for any help, Vance Forste --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] UVODBC procedure call from VBScript
Ok, Try the following. This works for me, all other routes seem to fall over :-( - Use a ? to substitute for each subroutine argument - Create an ADODB parameter for each argument - Set the value of the ADODB parameter - Append that parameter to the command Parameters collection NOTE: Using the ADODB.Command.CreateParameter does NOT seem to work with UniOleDB. Assuming that dbConn is an open UniOleDB connection, this calls a subroutine SelectTitle (similar to the one I posted before) in VB - and should work the same in VBScript: Dim dbParam As ADODB.Parameter Dim dbCmd As ADODB.Command ' Set the command to point to the SelectTitle subroutine Set dbCmd = CreateObject(ADODB.Command) dbCmd.ActiveConnection = dbConn dbCmd.CommandText = CALL SelectTitle(?) ' Create an unnamed parameter to substitute. Set dbParam = CreateObject(ADODB.Parameter) dbParam.Type = adBSTR dbParam.Value = Text1.Text dbCmd.Parameters.Append dbParam ' Execute and display results. RecordCount is -1 if data is found. Set dbRS = dbCmd.Execute If dbRS.RecordCount 0 Then dbRS.MoveFirst Do List1.AddItem dbRS.Fields(TITLE) dbRS.MoveNext Loop Until dbRS.EOF End If Hope this helps, Brian This is exactly what I wantto do. However the VBScript syntax is where I'm getting stuck. How do I set the arguments... I know with uvobj sub calls you need to set the parameter values for the routine. I'm assuming the same is true here. But this is what I have : dim cnn set cnn = Server.CreateObject(ADODB.Connection) cnn.Provider = IBM.UniOLEDB.1 dim dns dsn = DATA SOURCE=localuv;LOCATION=test;USER ID=test;PASSWORD=test; cnn.Open(dsn) dim rs, sql set rs = server.createobject(adodb.recordset) txtSubroutine = MYSUB SQL = {CALL txtSubroutine } rc = cnn.Execute (SQL) but my sub has arguments that need to be passed. I'm sure I'm looking right at the answer and looking right over it. Vance --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] UVODBC procedure call from VBScript
Hi, I don't see that you're passing any arguments. Assuming that you are in fact connecting, try: SQL = CALL MYSUB ('ARG1','ARG2'); IMHO, the UV docs really should contain an example for every definition. Brian Grayson [EMAIL PROTECTED] wrote: Brian, This is exactly what I wantto do. However the VBScript syntax is where I'm getting stuck. How do I set the arguments... I know with uvobj sub calls you need to set the parameter values for the routine. I'm assuming the same is true here. But this is what I have : dim cnn set cnn = Server.CreateObject(ADODB.Connection) cnn.Provider = IBM.UniOLEDB.1 dim dns dsn = DATA SOURCE=localuv;LOCATION=test;USER ID=test;PASSWORD=test; cnn.Open(dsn) dim rs, sql set rs = server.createobject(adodb.recordset) txtSubroutine = MYSUB SQL = {CALL txtSubroutine } rc = cnn.Execute (SQL) but my sub has arguments that need to be passed. I'm sure I'm looking right at the answer and looking right over it. Vance Dave: AFAIR this is documented in the less-than-obvious location of the UCI Guide. Here is a quick example using local UniVerse SQL in a subroutine as a stored procedure. I've used this with OleDB though not with ODBC, using the SQL CALL statement. NOTE that if you are using ODBC, I've found that {NATIVE} queries are very much quicker that regular ODBC queries. Check out the syntax for the NATIVE statement in the uvodbc guide. GetOrdersForCustomer 0001 SUBROUTINE( CustNo ) 0002 $Include UNIVERSE.INCLUDE ODBC.H 0003 0004 TCL = SELECT * FROM ORDERS WHERE CUSTNO = : CustNo 0005 T = SQLExecDirect(@HSTMT, TCL) 0006 RETURN Brian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Tabor Sent: 27 July 2005 13:14 To: u2-users@listserver.u2ug.org Subject: RE: [U2] UVODBC procedure call from VBScript Hi, Mr. Jordan. I've been considering using ODBC instead of UniObjects for our web project, too, but am unfamiliar with . Could you please include a small, very generic, code snippet to show what you mean here. It would be much appreciated! Thanks, Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of OZEMAIL Sent: Tuesday, July 26, 2005 6:21 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] UVODBC procedure call from VBScript To return a recordset from a UniBasic subroutine to an ODBC call you need to load data into the @HSTMT variable in the UniVerse Basic Subroutine. Regards David Jordan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 27 July 2005 6:31 AM To: u2-users@listserver.u2ug.org Subject: [U2] UVODBC procedure call from VBScript Hi all, I'm trying to convert a web app from Sybase to UV. I've been attempting to get a vbscript app to call a subroutine as a stored procedure. I am able to connect to the database using the OLE provider and retrieve recordsets. I'd like to be able to execute stored procs as well. IBM provided me with a VB sample to call a subroutine but I can't seem to implement it in VBScript. I've gone over the docs a million and one times and still can't seem to see what I'm missing. Does anyone have any samples, calling a subroutine through ODBC that would return a rescordset to the script that they would be able to share ? Thanks for any help, Vance Forste --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] UVODBC procedure call from VBScript
Hi, Mr. Jordan. I've been considering using ODBC instead of UniObjects for our web project, too, but am unfamiliar with . Could you please include a small, very generic, code snippet to show what you mean here. It would be much appreciated! Thanks, Dave Hi Dave Brian has provided examples, but it is worth considering what you are trying to do when selecting uniObjects and OLEDB. Uniobjects tends to be more stable, quicker than oledb. uniobjects is more tolerant of poor data and a lot easier to set up. However if your VB programmers don't understand PICK, then they might be more comfortable with OLEDB Regards David Jordan --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] UVODBC procedure call from VBScript
To return a recordset from a UniBasic subroutine to an ODBC call you need to load data into the @HSTMT variable in the UniVerse Basic Subroutine. Regards David Jordan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 27 July 2005 6:31 AM To: u2-users@listserver.u2ug.org Subject: [U2] UVODBC procedure call from VBScript Hi all, I'm trying to convert a web app from Sybase to UV. I've been attempting to get a vbscript app to call a subroutine as a stored procedure. I am able to connect to the database using the OLE provider and retrieve recordsets. I'd like to be able to execute stored procs as well. IBM provided me with a VB sample to call a subroutine but I can't seem to implement it in VBScript. I've gone over the docs a million and one times and still can't seem to see what I'm missing. Does anyone have any samples, calling a subroutine through ODBC that would return a rescordset to the script that they would be able to share ? Thanks for any help, Vance Forste --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/