在ms访问中搜索记录的问题

时间:2015-01-26 11:53:53

标签: vb.net visual-studio-2010

Dim MAX As Integer
Dim ID_NO, sql As String
Dim da As OleDb.OleDbDataAdapter
Dim dsl As New DataSet



ID_NO = InputBox("Please Enter The ID_NUMBER To Preview a Record")

sql = "SELECT * FROM PS_DTS WHERE ID_NO = (" & ID_NO & ")"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(dsl, "Search")
MAX = dsl.Tables("Search").Rows.Count
If MAX = 0 Then
    MsgBox("The ID_NO Entered is INVALID", MsgBoxStyle.Critical)
Else
    Exit Sub
    TextBox2.Text = dsl.Tables("Search").Rows(0).Item(1)
    TextBox3.Text = dsl.Tables("Search").Rows(0).Item(2)
    TextBox4.Text = dsl.Tables("Search").Rows(0).Item(3)
    TextBox5.Text = dsl.Tables("Search").Rows(0).Item(4)
    TextBox6.Text = dsl.Tables("Search").Rows(0).Item(5)
    TextBox29.Text = dsl.Tables("Search").Rows(0).Item(6)
    TextBox7.Text = dsl.Tables("Search").Rows(0).Item(7)
    TextBox8.Text = dsl.Tables("Search").Rows(0).Item(8)
    TextBox9.Text = dsl.Tables("Search").Rows(0).Item(9)
    DateTimePicker7.Value = dsl.Tables("Search").Rows(0).Item(10)
End If
dsl.Tables("Search").Rows.Clear()

0 个答案:

没有答案