mickeymouse
Solid State Member
- Messages
- 7
Hi to all, I am facing the below problems. I do not know why did the program went wrong, i just can't get it to debut.
The codes: (login.aspx)
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Dim strUser, strPwd As String
Dim retrieveUser, retrievePwd As String
strUser = txtUser.Text
strPwd = txtPwd.Text
Dim objDBMgmt As New DbMgmt
objDBMgmt.Connect()
Dim strSqlCmd As String
strSqlCmd = "Select UserId From User where UserId = '" & strUser & "'"
retrieveUser = objDBMgmt.ExecuteScalar(strSqlCmd)
strSqlCmd = "Select Password From User where Password = '" & strPwd & "'"
retrievePwd = objDBMgmt.ExecuteScalar(strSqlCmd)
If strUser = retrieveUser And strPwd = retrievePwd Then
Session("UserId") = retrieveUser
Session("Password") = retrievePwd
Response.Redirect("Home.aspx")
'invalid account
Else
lblErrMsg.Text = "Incorrect Email and password"
lblErrMsg.ForeColor = Color.Red
End If
'redirect to successful page
objDBMgmt.Close()
End Sub
Below is the extract of the error and i do not understand what it means.
The errors:
Server Error in '/VirtualSociety' Application.
Syntax error in FROM clause.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Syntax error in FROM clause.
Source Error:
Line 112:Line 113: sqlCmd.CommandText = cmdLine 114: value = sqlCmd.ExecuteScalar()Line 115:Line 116: Return value
Source File: c:\inetpub\wwwroot\VirtualSociety\DbMgmt.vb Line: 114
Stack Trace:
[OleDbException (0x80040e14): Syntax error in FROM clause.] System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) System.Data.OleDb.OleDbCommand.ExecuteScalar() VirtualSociety.DbMgmt.ExecuteScalar(String cmd) in c:\inetpub\wwwroot\VirtualSociety\DbMgmt.vb:114 VirtualSociety.Login.ImageButton1_Click(Object sender, ImageClickEventArgs e) in c:\inetpub\wwwroot\VirtualSociety\Login.aspx.vb:49 System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain()
The codes: (login.aspx)
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Dim strUser, strPwd As String
Dim retrieveUser, retrievePwd As String
strUser = txtUser.Text
strPwd = txtPwd.Text
Dim objDBMgmt As New DbMgmt
objDBMgmt.Connect()
Dim strSqlCmd As String
strSqlCmd = "Select UserId From User where UserId = '" & strUser & "'"
retrieveUser = objDBMgmt.ExecuteScalar(strSqlCmd)
strSqlCmd = "Select Password From User where Password = '" & strPwd & "'"
retrievePwd = objDBMgmt.ExecuteScalar(strSqlCmd)
If strUser = retrieveUser And strPwd = retrievePwd Then
Session("UserId") = retrieveUser
Session("Password") = retrievePwd
Response.Redirect("Home.aspx")
'invalid account
Else
lblErrMsg.Text = "Incorrect Email and password"
lblErrMsg.ForeColor = Color.Red
End If
'redirect to successful page
objDBMgmt.Close()
End Sub
Below is the extract of the error and i do not understand what it means.
The errors:
Server Error in '/VirtualSociety' Application.
Syntax error in FROM clause.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Syntax error in FROM clause.
Source Error:
Line 112:Line 113: sqlCmd.CommandText = cmdLine 114: value = sqlCmd.ExecuteScalar()Line 115:Line 116: Return value
Source File: c:\inetpub\wwwroot\VirtualSociety\DbMgmt.vb Line: 114
Stack Trace:
[OleDbException (0x80040e14): Syntax error in FROM clause.] System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) System.Data.OleDb.OleDbCommand.ExecuteScalar() VirtualSociety.DbMgmt.ExecuteScalar(String cmd) in c:\inetpub\wwwroot\VirtualSociety\DbMgmt.vb:114 VirtualSociety.Login.ImageButton1_Click(Object sender, ImageClickEventArgs e) in c:\inetpub\wwwroot\VirtualSociety\Login.aspx.vb:49 System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain()