开发者

Cannot call stored procedure from code which works on direct call to database

I connected to the Informix server using RazorSQL, created a stored procedure and tested it, getting the expected answer, so the procedure exists in the database in some form.

I then run the following code:

If ConnectToInformix() Then
    Dim cmd As New IfxCommand("dc_routeHasOutstandingQuantity", conn)
    cmd.CommandType = CommandType.StoredProcedure
    cmd.Parameters.Add(New IfxParameter("WorksOrder", wo_num))
    cmd.Parameters.Add(New IfxParameter("CompNo", IBM.Data.Informix.I开发者_StackOverflow社区fxType.SmallInt)).Value = CType(compNo, Int16)
    rdr = cmd.ExecuteReader

For completeness' sake, here is the ConnectToInformix function.

Private Function ConnectToInformix() As Boolean
    Try
        If conn Is Nothing Then
            conn = New IfxConnection
            conn.ConnectionString = ConnectionString
        End If
        If conn.State = System.Data.ConnectionState.Closed Then
            conn.Open()
        End If
        Return True
    Catch ex As System.Exception
        conn.Dispose()
        conn = Nothing
        Return False
    End Try
End Function

The ConnectToInformix function works fine for every other Informix connection made by this program, but this is the first Informix stored procedure being used, so maybe there's some special magic I have to work on the connection...

Anyway, when I try to call the stored procedure on the rdr = cmd.ExecuteReader line I get the following error:

ERROR [HY000] [Informix .NET provider][Informix]Cannot read system catalog (sysprocedures).

This error does not occur when calling the stored procedure from a live SQL connection.

What am I doing wrong?


First thing I'd check is you’re user has permissions to the database, and to that stored procedure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜