Connecting to Sql to retrieve data
Hi,
I never tried to connect to a database before and after reading a few previous posts and googling - I am confused as to the best way to connect to a SQL database to retrieve a single field in one table. ( I just want to get get the value from this field) to use as a status.
I don't want to update the DB at all just simpy read from it.
Can somebody point me in the right direction to simply do this?
An example would be great if possible.
thanks for you assistance
Steve
Re: Connecting to Sql to retrieve data
You make a connection to the database (use ADODB Code). Create a recordset. Write SQL Statement to retrieve data from the database. Asign the SQL Statement to the recordset and then open the recordset.
If the recordset contains data (not at BOF Or EOF) then assigne the returned value to a variable or some other oject on the form.
Re: Connecting to Sql to retrieve data