Custom Sql Odbc Error 关注

0
Avatar
Legacy Poster

When setting up a database connecting using a custom SQL statement, I am getting an ODBC error.  It looks like bartender is attempting to run the stored procedure and is passing in the QueryPrompt variable..  I have tried setting a default reply for the Query Prompt, but I get the same error

 

 

exec api.LabelQC @Param = N'?QueryPrompt1'
 

 

 

3 评论

0
Avatar
Legacy Poster
评论操作 固定链接

When using an ODBC connection, it shows an error but it does not save the query.

 

 

This is only happening for DSNs.  When I connect directly from BarTender using SQL Server OLE DB, I get an error message, but BarTender saves the custom query.

0
Avatar
Legacy Poster
评论操作 固定链接

I made a change to the stored procedure to check if the value passed is numeric.  If the value is not numeric it defaults to 0 then returns an empty result set.  Doing this prevents the SP from bombing on the conversion of the passed BarTender string parameter to integer.

 

Here is the workaround.. Not very elegant, but it works..

 

 

 

WHERE ID =  CASE WHEN IsNumeric(@Param) = 1 THEN @Param ELSE 0 END
0
Avatar
Shotaro Ito
版主
评论操作 固定链接

Thanks nhadley, for sharing the workaround!

请先登录再写评论。