Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 131,479 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,835 people online right now. Registration is fast and FREE... Join Now!




login login form with vb.net : how to verify ?

 
Reply to this topicStart new topic

login login form with vb.net : how to verify ?, VB.NET and SQL 2000 server

fei_hyblade
post 10 May, 2005 - 02:05 AM
Post #1


New D.I.C Head

*
Joined: 10 May, 2005
Posts: 11



Thanked 2 times
My Contributions


Hey smile.gif,great site here.kay i'll go straight to the point :

me and my friends are making an online database inventory application using VB.NET, and SQL Server 2000 for the database. it is meaned for our class final project.my question is,i need to make a login form to check the user name and password,but i cant seem to grasp on how to compare the input from the user with the data inside the database ? could u help me with any example code on how to compare and verify from the user input (username,password)in the textbox and the data in database ? smile.gif thank's very much ^^.
User is offlineProfile CardPM

Go to the top of the page


Amadeus
post 10 May, 2005 - 03:46 AM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,158



Thanked 31 times

Dream Kudos: 25
My Contributions


You username and password would be in variables from the form....
CODE

Dim username as string, pass as string
username = myForm.Text1.Value
pass = myForm.Text2.Value

Once you have the variables, simply look in the database for a matching record
CODE

"SELECT * FROM myTable WHERE username = '" & username & "'"

Please note that the quotes around username are single, then double, and are double, single, double at the end.

You'll run this query...if you find a matching record, the user is there, if you don't, they are not.
User is offlineProfile CardPM

Go to the top of the page

fei_hyblade
post 10 May, 2005 - 06:48 AM
Post #3


New D.I.C Head

*
Joined: 10 May, 2005
Posts: 11



Thanked 2 times
My Contributions


thx for the help amadeus smile.gif,i tried the following code :

Dim username as string, pass as string
username = frm_login.txt_name.Vallue
pass = frm_login.txt_pass.Value

placed it on a button named btn_login_click

it gives me the following error message :

"Reference to a non-shared member requires an object reference" (?)

and btw,that sql query command

"SELECT * FROM username_table WHERE username = 'username" & password = "password'"

where should i use it ? should i just "dim" a variable as sqlcommand ? (just guessing it up because it gives me a syntax error message).

sorry bout that,i'm new using this smile.gif and so grateful for your help.

ps.
could u recommend any reference book for this program ? (programmin vb.net and sql server and such) smile.gif.thx for the help !
User is offlineProfile CardPM

Go to the top of the page

fei_hyblade
post 10 May, 2005 - 06:49 AM
Post #4


New D.I.C Head

*
Joined: 10 May, 2005
Posts: 11



Thanked 2 times
My Contributions


oh,btw i change that username and password variable code into :

Dim username As String
username = Txt_Name.Text
Dim password As String
password = Txt_pass.Text

is this working too? smile.gif thx again
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/19/08 11:54PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month