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
it will connect
and do this
MAINMENU.show
unload me
-------------------------PLS HELP ME!!! =( --------------------------------
no question of pain. i feel always happy when i do reply to someone. ok, lets begin.
to connect the database without using the VDM you need to create an ODBC DSN for the type of database you wish to connected to.
to create the DSN follow the step:-
1.goto control panel
2.select administrative tools
3.select datasources(odbc)
4.in the user dsn tab click on add
5.select the appropriate database driver.
for access it is "Microsoft Access Driver(.mdb)"
for sql server it is "Sql Server"
for oracle it is "Oracle in orahome"
where version no. is the version of oracle u have installed in ur server machine.lets say if u have oracle9i installed then the driver becomes "oracle in orahome9i",etc.
6.after selecting the driver click finish.
7.then in the dsn dialog box enter the dsn name in the provided textbox.this name can be anything.but make sure that it doesn't conflict with other dsn names.
8.you can also specify a description fror ur dsn there.this is an optional field.
9.then click the select button and locate the database file you wish to connect through the new dsn being created.click ok to save all settings and create the dsn.
in case of operation with vb6 do the following steps:-
1.open a new project
2.goto project->reference
3.check on microsoft activex dataobjects library.again this version no. depends on the version of ur os and the version of ms-office u have installed.
4.click ok to add the reference to ur project.
*******now try this sample coding syntax***
'in form_load event......this is for connecting the database through the dsn dim conn as new adodb.connection
dim rs as new adodb.recordset
dim str as string
on error goto err1
str="DSN=;UID=;PWD=;DBQ="
conn.connectionstring=str
conn.open
msgbox "The database has been connected and ready for use."
exit sub
err1:
err.clear
msgbox "Connection failed.Please check ur DSN configuration."
exit sub
after this you will be in the condition to begin any transaction with the access,sql server and oracle databases.