Question Locked

binding a scalar table adaptor to a control in vb.net

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm trying to create a simple form which displays a combo box with data from a table tasks, I want to display only those tasks that are valid for entries in the Users_tasks table determined by the foreign key UserID from the users table.

I can't add a query to my existing table adaptors because the schema is different, so I added a query in the dataset designer to the query table adaptor.

I now have a scalar table adaptor , and call the query function and pass it the user id, but am unable to bind it to a control on my form.

Dim scalarQueriesTableAdapter As InsightAdminDataSetTableAdapters.QueriesTableAdapter

scalarQueriesTableAdapter = New InsightAdminDataSetTableAdapters.QueriesTableAdapter

scalarQueriesTableAdapter.SelectUserTasks(CurrentUserID)

when executing the query it returns the right data.

i tried adding the querytable adaptor as a datasource, but it doesn't show any of the fields, and the scalattable adaptor doesn't appear at all.

4 replies

by robo_dev

When you dim the variable, you need the () at the end or there's no bucket to put the bits into....

Dim northwindDataSet As New NorthwindDataSet()

Dim customersTableAdapter As New NorthwindDataSetTableAdapters.CustomersTableAdapter()

customersTableAdapter.Fill(northwindDataSet.Customers)

by gordon.hope-murray

I've compressed that into one lign, initialising the variable as I declare it and added the parentheses.

Dim scalarQueriesTableAdapter As New InsightAdminDataSetTableAdapters.QueriesTableAdapter()

still no luck though

by robo_dev

The bottom line is that the data that is returned to the form is not suitable, so it does not work.

I would guess that there is an error message like 'type mismatch' or 'invalid property value' hidden in there somewhere....

Here is some sample code:
http://www.vbforums.com/showthread.php?t=534121

This discussion is closed to new replies.