Monodevelop和调用存储过程

时间:2015-06-05 08:34:31

标签: vb.net stored-procedures monodevelop

在monodevelop-in操作系统中,Linux Ubuntu执行以下代码:

konekcija_cela.Open()
Dim cmd As New SqlClient.SqlCommand("Vrati", konekcija_cela)
cmd.CommandType = CommandType.StoredProcedure            
Try
Dim adapter As New SqlClient.SqlDataAdapter(cmd)
Dim ds As New DataSet
adapter.Fill(ds, "sluzbe") 
konekcija_cela.Close()
Catch ex As Exception
msgbox(ex)
End Try

我收到错误:

Unhandled Exception: System.IndexOutOfRangeException: Array index is out of
range.
at System.Data.Common.DataAdapter.FillTable (System.Data.DataTable dataTable,
IDataReader dataReader, Int32 startRecord, Int32 maxRecords, System.Int32&
counter) [0x00000] in <filename unknown>:0 
at System.Data.Common.DataAdapter.FillInternal (System.Data.DataTable
dataTable, IDataReader dataReader) [0x00000] in <filename unknown>:0 
at System.Data.Common.DataAdapter.Fill (System.Data.DataTable dataTable,
IDataReader dataReader) [0x00000] in <filename unknown>:0 
at System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable dataTable,
IDbCommand command, CommandBehavior behavior) [0x00000] in <filename unknown>:0 
at System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable dataTable)
[0x00000] in <filename unknown>:0 

当代替调用该过程而不执行以下代码时,它运行良好:

con.Open()
Dim cmd1 As New SqlClient.SqlCommand("SELECT    * FROM  nekatabela",   con) 
Dim adapter1 As New SqlClient.SqlDataAdapter(cmd1)
Dim ds1 As New DataSet
adapter1.Fill(ds1, "tabela")
con.Close() 

这是一个错误还是其他什么?当然,代码的两个部分都是
在Windows操作系统上测试并做得很好。如果有人有任何建议或建议 谢谢!

0 个答案:

没有答案