![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
急!vb.net问题“System.Data.SqlClient.SqlException”类型的异常
PrivateSubForm1_Load(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesMyBase.LoadD...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myconn As SqlClient.SqlConnection = New SqlClient.SqlConnection("data source=local;integrated security=sspi;initial catalog=shenxian")
Dim myadapter As New SqlClient.SqlDataAdapter
Dim mycmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("shx_proc;1", myconn)
Dim w As New System.Data.DataTable
mycmd.CommandType = CommandType.StoredProcedure
myadapter = New SqlClient.SqlDataAdapter(mycmd)
myadapter.Fill(w)
Me.DataGrid1.DataSource = w
Me.DataGrid1.CaptionText = "完整信息"
End Sub
问题出在myadapter.Fill(w)这一行
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。
其他信息: 系统错误。
问题出在哪? 展开
Dim myconn As SqlClient.SqlConnection = New SqlClient.SqlConnection("data source=local;integrated security=sspi;initial catalog=shenxian")
Dim myadapter As New SqlClient.SqlDataAdapter
Dim mycmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("shx_proc;1", myconn)
Dim w As New System.Data.DataTable
mycmd.CommandType = CommandType.StoredProcedure
myadapter = New SqlClient.SqlDataAdapter(mycmd)
myadapter.Fill(w)
Me.DataGrid1.DataSource = w
Me.DataGrid1.CaptionText = "完整信息"
End Sub
问题出在myadapter.Fill(w)这一行
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。
其他信息: 系统错误。
问题出在哪? 展开
展开全部
Me.DataGrid1.DataSource = w.tables["表名"]
存储过程的参数指定也要注意
存储过程的参数指定也要注意
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询