asp语法错误 [英] incorrect syntax asp
本文介绍了asp语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,程序员,请在此处查看即时消息.我知道我的语法是错误的.这是我的代码
hello programmers, see im new here. I know my syntax is error. here is my code
<pre lang="vb">Dim strSQL As String
Dim connection As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=ML0003135586;Integrated Security=SSPI;" & "Initial Catalog=TestSQL")
strSQL = "SELECT * from tblTrainingPlan Where WHERE ([Category] = @Category)"
connection.Open()
Dim myCommand As SqlClient.SqlCommand = New SqlClient.SqlCommand(strSQL, connection)
myCommand.Parameters.AddWithValue("@Category", 1)
gee.DataSource = myCommand.ExecuteReader()
gee.DataBind()
connection.Close()
可能错误为Incorrect syntax near the keyword ''WHERE''.
感谢
may error is Incorrect syntax near the keyword ''WHERE''.
thanks
推荐答案
删除多个"WHERE"子句:
Take the multiple "WHERE" clauses out:
strSQL = "SELECT * from tblTrainingPlan Where WHERE ([Category] = @Category)"
成为
becomes
strSQL = "SELECT * from tblTrainingPlan WHERE ([Category] = @Category)"
您的查询具有双精度值,其中
Your query has double where
strSQL = "SELECT * from tblTrainingPlan Where WHERE [Category] = "''+@Category+''""
我认为这是错误,因为Error上的say语法
i thinks that is the error since the says syntax on Error
Dim strSQL As String
Dim connection As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=ML0003135586;Integrated Security=SSPI;" & "Initial Catalog=TestSQL")
strSQL = "SELECT * from tblTrainingPlan Where WHERE ([Category] = " + "1" + ")"
connection.Open()
Dim myCommand As SqlClient.SqlCommand = New SqlClient.SqlCommand(strSQL, connection)
gee.DataSource = myCommand.ExecuteReader()
gee.DataBind()
connection.Close()
这篇关于asp语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文