不会啊,语法没错,你把这个sql语句输出看一下。
对了,你用的是什么数据库?access的like语句不是这么写的。
http://smallfools.blog.hexun.com/3101783_d.html
access里的模糊查询语句:SELECT * FROM 表名 WHERE (字段名 LIKE '%%查询的字符串%%'
还是不行
帮我看看是不是程序有问题啊!!!
Dim conn As OleDbConnection
Dim str As String
conn = New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("test.mdb"))
str = "select * from selecting where question like '%% TextBox1.Text %%'"
Dim dt As New DataTable
Dim cmd As New OleDbCommand(str, conn)
Dim da As New OleDbDataAdapter(cmd)
Try
conn.Open()
da.Fill(dt)
Dim count As String
count = cmd.ExecuteScalar
If count = 0 Then
Label2.Text = "对不起,没有符合条件的题目!"
Return
Else
DataGrid1.DataSource = dt
DataGrid1.DataBind()
End If
conn.Close()
Catch ex As Exception
Response.Write(ex.Message)
End Try