•
•
•
•
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,521 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,802 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: 1891 | Replies: 3
![]() |
hello every1, really i need help on how i can make a login form that works and is connected to my database using ADO
my frmlogin is composed of 2 textbox (txtuser,txtpass)
and 2 command buttons (cmdlogin,cmdcancel)
and my database name is (MAINDB2)
inside MAINDB2 is (tblReg)
fields inside tblReg is (Username,Password)
and for example , field Username contains (tester)
, field Password contains (testpass)
and when i put (tester) in the txtuser
and (testpass) in the txtpass
i will do this
MAINMENU.show
unload me
-------------------------PLS HELP ME!!! =( --------------------------------
my frmlogin is composed of 2 textbox (txtuser,txtpass)
and 2 command buttons (cmdlogin,cmdcancel)
and my database name is (MAINDB2)
inside MAINDB2 is (tblReg)
fields inside tblReg is (Username,Password)
and for example , field Username contains (tester)
, field Password contains (testpass)
and when i put (tester) in the txtuser
and (testpass) in the txtpass
i will do this
MAINMENU.show
unload me
-------------------------PLS HELP ME!!! =( --------------------------------
•
•
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,444
Reputation:
Rep Power: 4
Solved Threads: 87
hi,
Follow the below instructions, if u hv any doubts u can ask me.
1) First set reference to use ADO Project Menu-> Reference-> Microsoft Activex Data Objects 2.6 Library
2) Create DSN Start-> Run->odbcad32->ADD
MS- Access
Select Microsoft Access Driver(*.mdb)-> Finish
type the name in Data Source Name
then select database by clicking select button
browse the database then press ok again press ok
DSN Created
Oracle
Select Microsoft ODBC for Oracle-> Finish
type the name in Data Source Name, username of oracle
and server name of oracle(i.e.host string)
then press ok
DSN Created
Sql Server
Select Sql Server-> Finish
type the name in Data Source Name
select the system name in server where your database is located
then press next select with Sql Server authentication
and unmark check box and give the username and password of your sql server
then press next select database press next finally click finish
DSN Created
3) Code
'write the code outside the procedure
Dim cn as new Adodb.connection
Dim rs as new Adodb.recordset
Private Sub Form_Load()
set cn = new adodb.connection
set rs = new adodb.recordset
'Accesscn.open "login",false
'Oraclecn.open "login","scott","tiger"
'Sql Server if password available give password
cn.open "login","sa",false
End Sub
Private Sub Command1_Click()
rs.open "select count(*) from login where username = '" & text1.text & "' and password = '" & text2.text & "'",cn,adopendynamic,adlockoptimistic
if rs(0)=0 then
msgbox "Unknown User"
else if rs(0)=1 then
MAINMENU.show
unload me
end if
End Sub
shailu
Follow the below instructions, if u hv any doubts u can ask me.
1) First set reference to use ADO Project Menu-> Reference-> Microsoft Activex Data Objects 2.6 Library
2) Create DSN Start-> Run->odbcad32->ADD
MS- Access
Select Microsoft Access Driver(*.mdb)-> Finish
type the name in Data Source Name
then select database by clicking select button
browse the database then press ok again press ok
DSN Created
Oracle
Select Microsoft ODBC for Oracle-> Finish
type the name in Data Source Name, username of oracle
and server name of oracle(i.e.host string)
then press ok
DSN Created
Sql Server
Select Sql Server-> Finish
type the name in Data Source Name
select the system name in server where your database is located
then press next select with Sql Server authentication
and unmark check box and give the username and password of your sql server
then press next select database press next finally click finish
DSN Created
3) Code
'write the code outside the procedure
Dim cn as new Adodb.connection
Dim rs as new Adodb.recordset
Private Sub Form_Load()
set cn = new adodb.connection
set rs = new adodb.recordset
'Accesscn.open "login",false
'Oraclecn.open "login","scott","tiger"
'Sql Server if password available give password
cn.open "login","sa",false
End Sub
Private Sub Command1_Click()
rs.open "select count(*) from login where username = '" & text1.text & "' and password = '" & text2.text & "'",cn,adopendynamic,adlockoptimistic
if rs(0)=0 then
msgbox "Unknown User"
else if rs(0)=1 then
MAINMENU.show
unload me
end if
End Sub
shailu
•
•
•
•
hello every1, really i need help on how i can make a login form that works and is connected to my database using ADO
my frmlogin is composed of 2 textbox (txtuser,txtpass)
and 2 command buttons (cmdlogin,cmdcancel)
and my database name is (MAINDB2)
inside MAINDB2 is (tblReg)
fields inside tblReg is (Username,Password)
and for example , field Username contains (tester)
, field Password contains (testpass)
and when i put (tester) in the txtuser
and (testpass) in the txtpass
i will do this
MAINMENU.show
unload me
-------------------------PLS HELP ME!!! =( --------------------------------
![]() |
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- login form (PHP)
- Login form in VB.net (VB.NET)
- Need help to create a login form (VB.NET)
- Help with making a survey form (HTML and CSS)
- Making a Fullscreen form and hiding the Windows Taskbar (Pascal and Delphi)
- login scripts (PHP)
- php login form (PHP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: how to load a random cell in a fild on VB
- Next Thread: date range VB6



Linear Mode