怎样解决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 子句语法错误。 展开
<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 子句语法错误。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询