level 1
394562300
楼主

Imports System.Data.SqlClientPublic Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SqlDataAdapter1.Fill(DataSet11, "t_grade")
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As New SqlConnection("Initial Catalog = school;" _
& "Integrated Security = SSPI;")
Dim sql As String = "Select * From t_grade Where studentcode = '" & TextBox1.Text & "'"
Dim ad As SqlDataAdapter = New SqlDataAdapter(sql, cn)
Dim ds As New DataSet()
ad.Fill(ds, "t_grade")
DataGrid1.DataSource = ds.Tables("t_grade ") End Sub
End Class
为什么我点下查询之后一个数据都没有了?这是什么原因啊?大神??!!