3 Replies - 61395 Views - Last Post: 10 May 2005 - 07:49 AM Rate Topic: -----

#4 fei_hyblade  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 11
  • Joined: 10-May 05

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

Posted 10 May 2005 - 03:05 AM

Hey :),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 ? :) thank's very much ^^.
Was This Post Helpful? 1

#8 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

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

Posted 10 May 2005 - 04:46 AM

You username and password would be in variables from the form....
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
"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.
Was This Post Helpful? 1

#9 fei_hyblade  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 11
  • Joined: 10-May 05

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

Posted 10 May 2005 - 07:48 AM

thx for the help amadeus :),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 :) and so grateful for your help.

ps.
could u recommend any reference book for this program ? (programmin vb.net and sql server and such) :).thx for the help !
Was This Post Helpful? 0
  • +
  • -

#10 fei_hyblade  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 11
  • Joined: 10-May 05

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

Posted 10 May 2005 - 07:49 AM

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? :) thx again
Was This Post Helpful? 1

Page 1 of 1