此错误以5:1.4的比例生成,它将无错误地工作,但下一次运行时,它将返回相同查询字符串的错误“对象引用未设置为对象的实例”。
我的系统使用web服务(SVC)连接到MySql数据库,用于其所有CRUD操作。错误列于下:
System.Web.Services.Protocols.SoapException:从customer_number中删除,其中cus_id =4对象引用没有设置为对象的实例。在System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage消息、WebResponse响应、流responseStream、布尔asyncCall( at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName )、Object[]参数) at POS.ThePOSServerService.PosMain.ExecuteQueryBool(String strQuery、String Company、String User、String Pass)在Reference.vb:line 266中
虽然生成错误的代码如下所示:Try 261 Dim ConnectionString As String = _ ConfigurationManager.ConnectionStrings(Company).ConnectionString 262 'Dim sCommand As StringBuilder = New 262 - StringBuilder(strQuery) 263 Using mConnection As MySqlConnection = New MySqlConnection(ConnectionString) 264 mConnection.Open() 265 Using myCmd As MySqlCommand = New MySqlCommand(strQuery, mConnection) 266 myCmd.CommandType = CommandType.Text 267 Result = myCmd.ExecuteNonQuery() > 0 268 End Using 269 End Using、Catch、ex作为异常抛出新的ApplicationException(ex.ToString) End,但我只想将结果作为值返回为True或False。
发布于 2019-09-01 10:17:08
这是我的错。从未检查连接字符串是否正确地进入函数。一旦我纠正了(给出正确的连接字符串),一切都如期而至。不管怎样,都要感谢你。
https://stackoverflow.com/questions/57668362
复制相似问题