im going to try to explain this the best i can
the programs here are setup using adodb.connection and adodb.recordset
they run threw an odbc connecter that is on each machine in the company (i dont know, i didn't do it).
here is what i do with the adors
module moddata
private adoconnect as new adodb.connection
public adors as new adodb.recordset
public function db_adors_connect(byval strquery as string) as boolean
try
if moddata.adoconnect.state = connectionstate.open then call moddata.db_adors_close()
moddata.adoconnect.open(dsn, user, pass)
moddata.adors.open(strquery$, adoconnect, 3)
if moddata.adors.eof = false then return true
catch ex as exception
'error handling code'
end try
end function
public sub db_adors_close()
moddata.adoconnect.close
end sub
end module
then in my regular code i do the following
if moddata.db_connect("query") = true then
whateverfield.text = moddata.adors.fields("WHATEVERCOLUMN").value
end if
call moddata.db_disconnect
I have never used the mysql.data.mysqlclient, but i am interested in trying to accomplish similiar to the same thing:
i am giving it a try as of today, but having a little confusion
imports mysql.data.mysqlclient
module moddata
dim sqlConnector as mysqlconnection
public function connect_db(byval strquery as string) as boolean
try
if moddata.sqlconnector.state = connectionstate.open then call moddata.db_close()
sqlconnector.connectionstring = "Server=ip; Uid=yes; Pwd=no; database=;ok;"
sqlconnector.open()
' i want it to do something along the lines of if recordset.eof = false then return true here
catch ex as exception
msgbox(ex.message)
end try
end function
public sub close_db()
sqlconnector.close
end sub
end module
hopefully i explained this ok..