Hard Coded SQL Select Statement?

Bigox

Member
Joined
Nov 19, 2005
Messages
8
Programming Experience
Beginner
1. Much like my last question I simply want to send a sql statement to my access db..this time instead of executing an insert i want results form a select statement... now I know how to set up the connex and proper syntax,,, my question is instead of .executenonquery what do I use?

2. Once I execute the select statement, how do I display the results in a datagrid and or array? (prefer something like a data grid so that I do not have to code the array to display into controls on my form)

Thanks so much. This place is great I am adding to favorites =).
 
.Fill .... use the .Fill of the dataadaptor to fill (get it?) the DataSet...

-tg
 
.

I was not planning to use a data adapter but rather send the sql statement to access straight via oledb.command

are you saying i do something like

SelectStatement.fill ?

Thanks as always.
 
There are two ways to get data from a databse using ADO.NET. You can either call Fill on a DataAdapter, which is the easy way from a coding point of view but is less efficient. The other way is to call ExecuteReader to get a DataReader that you can then use to read the result set one row at a time. Either way, you aren't really sending and SQL statement straight to Access. A DataAdapter has a SelectCommand property that is a Command object, so it's just executing the same SQL statement. It's just that the DataAdapter also does some other work for you as well, but it doesn't do it as quickly as you could do it yourself because it is more generalised.
 
Back
Top