User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 456,526 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,807 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 1245 | Replies: 6 | Solved
Reply
Join Date: Jul 2007
Posts: 6
Reputation: rumi is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rumi's Avatar
rumi rumi is offline Offline
Newbie Poster

Help 'syntax error in FROM clause'

  #1  
Oct 2nd, 2007
hi.im facing an error that says 'syntax error in FROM clause'.i dont know where i went wrong because it used to run smoothly.from my research about this error,it seems each solution is unique,it doesnt relate to what im doing.can anyone please help?here are my codes:
Private Sub Cmd_Login_Click()
Adodc1.RecordSource = "SELECT * FROM User Where user_name='" & Txt_Name.Text & "'"
Adodc1.Recordset.Requery
Adodc1.Refresh

If Adodc1.Recordset.RecordCount = 0 Then 'user doesnt exist
    MsgBox "Bad Username! Try again."
    Exit Sub 'so that it won't move on checking the password
End If

'user exist,check password
If Adodc1.Recordset.Fields("password") = Txt_Pass.Text Then
    If Adodc1.Recordset.Fields("user_status") = "admin" Then 'check user status
    'current_user = Adodc1.Recordset.Fields("user_name").Value
    MsgBox "Login Successful!"
    Unload Me
    A2_AdminMain.Show 'login Admin Page
    Else
    current_user = Adodc1.Recordset.Fields("user_name").Value
    MsgBox "Login Successful!"
    Unload Me
    A2_UserMain.Show 'login user page
    End If

Else 'Wrong Password
    MsgBox "Wrong password. Try again."
End If

End Sub
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: 'syntax error in FROM clause'

  #2  
Oct 2nd, 2007
Try this:
Adodc1.RecordSource = "SELECT * FROM [User] Where user_name='" & Txt_Name.Text & "'"

If that doesn't work, check the table name 'User' is correct in your database.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,444
Reputation: debasisdas is on a distinguished road 
Rep Power: 4
Solved Threads: 87
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Virtuoso

Re: 'syntax error in FROM clause'

  #3  
Oct 2nd, 2007
The keyword User might not be supported, check for that in the databse that u are using.
Share your Knowledge.
Reply With Quote  
Join Date: Jul 2007
Posts: 6
Reputation: rumi is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rumi's Avatar
rumi rumi is offline Offline
Newbie Poster

Re: 'syntax error in FROM clause'

  #4  
Oct 2nd, 2007
i got it.i change the name of my table from: 'User'->'Table_user' in my database.
it works fine.why does this happen?is the keyword 'user' a special case?
Reply With Quote  
Join Date: Oct 2007
Posts: 5
Reputation: lampie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
lampie's Avatar
lampie lampie is offline Offline
Newbie Poster

Re: 'syntax error in FROM clause'

  #5  
Oct 3rd, 2007
yup! we can't use user as table name in database because it's already exist.

i think it was used to store the data about users of database development software (such as sql server) , for example: login name that we use to login to the sql server..
Reply With Quote  
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,444
Reputation: debasisdas is on a distinguished road 
Rep Power: 4
Solved Threads: 87
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Virtuoso

Re: 'syntax error in FROM clause'

  #6  
Oct 3rd, 2007
USER is a restricted key word. Most of the databases do not support any object by this name.
Share your Knowledge.
Reply With Quote  
Join Date: Aug 2007
Posts: 32
Reputation: nuBudDy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
nuBudDy nuBudDy is offline Offline
Light Poster

Re: 'syntax error in FROM clause'

  #7  
Oct 3rd, 2007
i faced the same problem 2.using the name 'user' as a table name doesnt work.i tried searching for ways to overcome but failed.n now i know why.thanx evryone
Last edited by nuBudDy : Oct 3rd, 2007 at 4:58 am. Reason: correction
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 4:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC