The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Unable to Parse a StoredProcedure with parameters
Posted: 19 Jun 08 9:04 AM
|
I created a stored Procedure in SQL Management Studio called dbo.ewusp_CalculateSalesClaimsRatio which takes an input parameter which would be the accountid of an Account.
In my code i set the SQL command to the following
strSQL = "exec dbo.ewusp_CalculateSalesClaimsRatio '" & txtAccountID.Text & "'"
and the Architect returns an error that it is unable to parse SQL.
When I default the SP parameter to a value of an AccounId and set strSQL = "exec dbo.ewusp_CalculateSalesClaimsRatio" it works fine.
Is there a problem with SLX SQL parser that it can't read parameters on Stored procedures? |
|
|
|
Re: Unable to Parse a StoredProcedure with parameters
Posted: 20 Jun 08 4:27 AM
|
Hi Paul,
I haven't studied this massively and/or definitively but did get a similar problem myself and decided to try the sql using a standard ADODB connection, rather than using the SLX 'Architect' connection - this then worked for me.
Try using the connection example below (obviously changing the Server/DB references to your own) and see how you get on...
Dim objConn Set objConn = CreateObject("ADODB.Connection") objConn.Open ("Provider=sqloledb;Data Source=SLXServer;Initial Catalog=SLXDb;User Id=sa assword=sapwd;") objConn.Execute("exec dbo.ewusp_CalculateSalesClaimsRatio '" & txtAccountID.Text & "'") objConn.Close Set objConn = Nothing |
|
|
|
Re: Unable to Parse a StoredProcedure with parameters
Posted: 20 Jun 08 12:18 PM
|
Paul, try adding your parameters to the command.parameters collection rather than inline.
Command.CommandText = "ewusp_CalculateSalesClaimsRatio" Command.Parameters("@AccountID").Value = txtAccountID.Text
If this does not work, please post your code. We may be able to spot issues with the ado object properties or something along those lines.
Timmus |
|
|
| |
| |
|
Re: Unable to Parse a StoredProcedure with parameters
Posted: 11 Jul 08 8:47 AM
|
Any answers for this? I have the same problem. Here is the code
strSQL = "EXECUTE c_GetOpportunityTrend @lcOpportunityid = '" & frmOpportunityTrends.CurrentID & "'"
Set objCon = Application.GetNewConnection Set objRS = CreateObject("ADODB.Recordset") objRS.CursorType = 3 'adOpenStatic objRS.CursorLocation = 3 'adUseClient objRS.LockType = 3 'adLockOptimistic objRS.Open strSQL, objCon 'Provider
Thanks! John G. |
|
|
|