Jimbo99999
asked on
VB.Net - Most "Compact" Query Retrieval
Good Day Experts!
I need to execute a Select top 1 *...query and get a couple of field values returned by the query.
What is the most "compact" way with minimum lines of code that I can achieve my desired results?
Thanks,
jimbo99999
I need to execute a Select top 1 *...query and get a couple of field values returned by the query.
What is the most "compact" way with minimum lines of code that I can achieve my desired results?
Thanks,
jimbo99999
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent...thanks for the help.
Jimbo99999
Jimbo99999
create a class for connection to db
create a shared method within this class that fills a datatable with the values from the query
Open in new window
then just need to initialize the clsdb connection once in the main form
clsdb.Database = "dbname"
clsdb.Server = "192.168.1.xx\sqlservernam
clsdb.userid= "sa"
clsdb.Password = "myserverpass"
then you can populate datatable with :
clsdb.fillDt("SELECT TOP(1) row1, row2)", mydatatable)
Just one line of code