Good day,
Just want to ask some help, Please!
I always encounter "Cannot find Table 0" when i call Stored Procedure in DB2 using VB .Net with Ole DBConnection Provider. Here is my code:
Private Sub cmdPost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPost.Click
rsSearch = clsDAOMngr.getConfigParam(2)
For i = 0 To rsSearch.Tables.Count Step 1
With rsSearch.Tables(0)
MsgBox(.Rows(i)(0).ToString())
End With
Next
End Sub
'-------------------------------------------------------
Public Function getConfigParam(ByVal strParameter As String) As DataSet
getConfigParam = Nothing
Dim sProcedure As String = ""
sProcedure = "EDMS.SAMPLE_SELECT2"
getConfigParam = clsDBMngr.executeStoredProcedure_split(sProcedure, strParameter, 1)
End Function
'-------------------------------------------------------
Public Function executeStoredProcedure_split(ByVal spname As String, ByVal strparam As String, ByVal numberOfSInput As Integer) As DataSet
executeStoredProcedure_split = Nothing
Try
command.CommandType = CommandType.StoredProcedure
command.CommandText = spname
command.Connection = connection_oledb
connection_oledb.Open()
arrStrParam = strparam.Split("|")
OleDbCommandBuilder.DeriveParameters(command)
For i = 0 To numberOfSInput - 1 Step 1
parameterValue = arrStrParam(i)
command.Parameters(i).Value = parameterValue
Next
adapter = New OleDbDataAdapter(command)
executeStoredProcedure_split = New DataSet(command.CommandText)
Dim dataTable As DataTable = executeStoredProcedure_split.Tables(0)
adapter.Fill(executeStoredProcedure_split)
command.Parameters.Clear()
connection_oledb.Close()
Return executeStoredProcedure_split
Catch
connection_oledb.Close()
MsgBox(Err.Description, MsgBoxStyle.Critical, strtitle)
Exit Function
End Try
End Function
Please help.
Thanks in advance :))