VB Express - How to access query value on my form?

G

Guest

I've created a query using the Query Designer under VB Express, and I
can execute it in the Query Designer to verify that it returns the data
I want. My database is called Area. It contains one table called
Place. My Data Sources window shows AreaDataSet at the top, and the
Places table underneath. Expanding the Places table shows me each
individual column in that table.

When I right-click in the Data Sources window, and choose "Edit Dataset
in Designer", I get a window called AreaDataSet.xsd, which contains two
boxes. One box is called "Place", and lists all the columns in my
Place table, followed by a PlaceDataAdapter which contains one SQL
query: Fill GetData(). The second box is called QueriesTableAdapter,
and contains the SQL query I'm trying to access on my form: ScalarQuery
().

When I right-click in the AreaDataSet.xsd window and choose "Preview
Data", I get a popup window asking me to select an object to preview.
Expanding the dropdown list, and selecting ScalarQuery (), I get
AreaDataSet.ScalarQuery () as my selection, and clicking the Preview
button shows me the data I want to display in my form (the column is
called "Expr1").

My problem is that I don't see how to get this data in my form. The
Data Sources window that's shown when my Form's Design View is
displayed doesn't contain the ScalarQuery, or a QueriesTableAdapter.
I'm still a VB neophyte, but I'm chipping away at it. Can somebody
help me out?
 
G

Guest

Hi,

Drag the AreaDataSet on the form from the datasource window. It
will generate a tableadapter, datagridview, etc for you.

Ken
 
G

Guest

I did that before I generated my query, and the AreaDataSet,
PlaceBindingSource, PlaceTableAdapter, and PlaceBindingNavigator are
already available in my Design view. The problem is that I don't know
how to go about getting that Expr1 field from my query into anything I
can drag onto the form in a design view.
 
G

Guest

Hi,

You will not see the data in design view only the column names.
Once you run it the data will show up.

Ken
 
G

Guest

There is no column name for Expr1 in the Design View, so I don't know
how to request the data on my form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top