怎样解决asp.netFROM 子句语法错误。

我正在写一段登陆代码<scriptrunat="server">FunctionCreateDataSet(ByValstrSQLAsString,ByValFileNa... 我正在写一段登陆代码
<script runat="server">
Function CreateDataSet(ByVal strSQL As String, ByVal FileName As String, ByVal TableName As String) As Data.DataSet
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(FileName)
Dim objCmd As New Data.OleDb.OleDbDataAdapter(strSQL, ConnString)
Dim DS As New Data.DataSet()
objCmd.Fill(DS, TableName)
CreateDataSet = DS
End Function

Protected Sub logo(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myConnection As Data.OleDb.OleDbConnection
myConnection = New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Exam.mdb"))
Dim searchCmd As String
searchCmd = "select * from user where username= '" & username.Text & "' and password='" & password.Text & "'"
Dim myCommand As Data.OleDb.OleDbCommand = New Data.OleDb.OleDbCommand(searchCmd, myConnection)
myCommand.Connection.Open()
Dim myReader As Data.OleDb.OleDbDataReader = myCommand.ExecuteReader()

If myReader.Read() Then
Session("userid") = username.Text
Response.Redirect("Admin.aspx")
ElseIf Not myReader.Read() Then
label.Text = "你的输入有误"
label.Style("color") = "red"
End If
myCommand.Connection.Close()
End Sub
</script>
在这段代码中老实说FROM 子句语法错误。怎么修改都不行,希望尽快帮帮我,谢谢!
Dim myReader As Data.OleDb.OleDbDataReader = myCommand.ExecuteReader()
老是说异常详细信息: System.Data.OleDb.OleDbException: FROM 子句语法错误。
展开
 我来答
万事俱备就差一个程序员了
2010-07-30 · TA获得超过225个赞
知道小有建树答主
回答量:659
采纳率:0%
帮助的人:296万
展开全部
searchCmd = "select * from user where username= '" & username.Text.toString & "' and password='" & password.Text.toString() & "'"
百度网友30cc6ab
2010-07-30 · TA获得超过574个赞
知道小有建树答主
回答量:1336
采纳率:0%
帮助的人:852万
展开全部
哪一行?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式