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


if moddata.adoconnect.state = then call moddata.db_adors_close(), user, pass)$, 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()
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, 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


module moddata

dim sqlConnector as mysqlconnection

public function connect_db(byval strquery as string) as boolean


 if moddata.sqlconnector.state = then call moddata.db_close()

 sqlconnector.connectionstring = "Server=ip; Uid=yes; Pwd=no; database=;ok;"

 ' i want it to do something along the lines of if recordset.eof = false then return true here

catch ex as exception


end try
end function

public sub close_db()
end sub

end module

hopefully i explained this ok..

Recommended Answers

All 6 Replies

sorry, what im asking is how do i return a recordset for the similiar to the way i do with the adodb.recorset?

great - i have it working the way i like but i am still left with a question

is there a way to pull a database column by its name instead of using its index ie reader(0) pulls the first column. is there a way to load by column name?

thanks again.

Yes, is you want to sort data use next SQL statement:

SELECT collumnName FROM tableName

.. i think i understand what you are saying but im not sure..

heres an example of what i mean though

sql query:

SELECT system_user, product, customer FROM sales_detail WHERE ID = 1234

in adodb .net

me.txtassociate.text = moddata.adors.fields("System_User").value
me.txtproduct.text = moddata.adors.fields("product").value
me.txtcustomer.text = moddata.adors.fields("customer").value

the same query using the mysqlclient

me.txtassociate.text =
me.txtproduct.text =
me.txtcustomer.text =

can i use the mysqlreader like the adodb

me.txtassociate.text ="System_User").value

... hope that clears up what i was asking

SQL Query is valid. For ADODB I don't know because I never used it. You can use get data from MySQL with ODBC.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.