vb.net搜索卡住了ms访问 [英] vb.net search stuck with ms access

查看:66
本文介绍了vb.net搜索卡住了ms访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..



当我试图制作另一个搜索订单时程序卡住了..

i意味着我可以制作1搜索操作,然后再做另一个1



这是代码



Hi..

when i''m trying to make another search order the program stuck..
i mean i can make 1 search operation and then cant do another 1

this is code

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Static m As Integer = 0


       If TextBox1.Text = Trim("") Then Exit Sub
       If RadioButton4.Checked = True Then
           ExactSearch()
       ElseIf RadioButton5.Checked = True Then
           GeneralSearch()
       End If

       Conn.Open()
       Dim DataAdapter1 As New OleDbDataAdapter(SQLstr, Conn)
       DataAdapter1.Fill(DataSet1, "Table1")
       Conn.Close()

       TextBox2.DataBindings.Add("Text", DataSet1, "Table1.Name")

       TextBox3.DataBindings.Add("Text", DataSet1, "Table1.DatTim")

       TextBox4.DataBindings.Add("Text", DataSet1, "Table1.mobile")

       DataGridView1.DataSource = DataSet1
       DataGridView1.DataMember = "Table1"

       ''Button1.Enabled = False
       If Me.BindingContext(DataSet1, "Table1").Count = 0 Then
           MsgBox("No Result, Please Try Again ")
           Exit Sub
       End If

       Button2.Enabled = True
       Button3.Enabled = True
   End Sub
   Public Sub ExactSearch()
       If RadioButton1.Checked = True Then
           SQLstr = "SELECT * FROM Table1 WHERE name = ''" & TextBox1.Text & "''"
       ElseIf RadioButton2.Checked = True Then
           SQLstr = "SELECT * FROM Table1 WHERE DatTim = ''" & TextBox1.Text & "''"
       ElseIf RadioButton3.Checked = True Then
           SQLstr = "SELECT * FROM Table1 WHERE mobile = ''" & TextBox1.Text & "''"
       End If
   End Sub
   Public Sub GeneralSearch()
       If RadioButton1.Checked = True Then
           SQLstr = "SELECT * FROM Table1 WHERE name LIKE ''%" & TextBox1.Text & "%''"

       ElseIf RadioButton2.Checked = True Then
           SQLstr = "SELECT * FROM Table1 WHERE DatTim LIKE ''%" & TextBox1.Text & "%''"

       ElseIf RadioButton3.Checked = True Then
           SQLstr = "SELECT * FROM Table1 WHERE mobile LIKE ''%" & TextBox1.Text & "%''"

       End If
   End Sub



卡在这里


stuck here

TextBox2.DataBindings.Add("Text", DataSet1, "Table1.Name")





help plz



help plz

推荐答案

看看这里了解MS Access搜索选项:

访问通配符字符引用 [ ^ ]

在Access数据库中查找通配符 [ ^ ]

与运算符类似 [ ^ ]

WHERE子句 [ ^ ]

在字符串比较中使用通配符 [ ^ ]

运营商表格 [ ^ ]
Have a look here to understand MS Access search options:
Access wildcard character reference[^]
Find wildcard characters in an Access database[^]
Like Operator[^]
WHERE Clause[^]
Using Wildcard Characters in String Comparisons[^]
Table of operators[^]


这篇关于vb.net搜索卡住了ms访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆