在数据库查询中执行如下语句: Private Sub Btnquery_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnquery.Click query(Me.cmbregion.SelectedText) End Sub
Private Sub query(ByVal value As String) Dim strsql As String = "select * from fac where ID=@value" Dim str As String = "workstation id=CKW;packet size=4096;integrated security=SSPI;data source=""CKW\KW""" & _ ";persist security info=False;initial catalog=xmlead" Dim conn As New SqlConnection(str) Dim comm As New SqlCommand comm.CommandText = strsql comm.Connection = conn comm.Parameters.Add("@value", SqlDbType.VarChar).Value = value Try conn.Open() Dim dr As SqlDataReader = comm.ExecuteReader Me.DataGrid1.DataSource = dr ' Me.DataGrid1.DataMember = "table" Catch ex As Exception MessageBox.Show(ex.Message) Finally If conn.State <> ConnectionState.Closed Then conn.Close()
End If
End Try
End Sub
End Class 出现高级数据绑定Ilist或IlistSource做数据源的异常!
[此贴子已经被作者于2005-4-8 21:41:22编辑过]