Need help accessing Stored Query

Hello,

I'm a VB.net beginner.  

My project has a Data Source called On_OrderDataSet which works great.  I'm able to access objects in this data source using code like this:
Dim dtCustomer As DataTable = On_OrderDataSet.Tables("Tbl_Customers")

Open in new window


So, I added a stored parameter-ized query, named Qry_Customers, using the Add option in the .xsd file.  Screenshot shows it.  Problem is that I can't figure out how to use Qry_Customers in my code.  I'd like to do something like:
Dim dtCustomer As DataTable = On_OrderDataSet.Queries("Qry_Customers")

Open in new window

 But it doesn't work.
Screenshot of Data Sources and QueriesTableAdapaterHow do I do fill a DataTable or DataRow object using Qry_Customers?  Code would be helpful.
Thanks,
Jason
SqueezeOJAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
The QueriesTableAdapter is intended more for executing scalar queries, or performing UPDATE/INSERT/DELETE operations.

Instead you should be adding your query to the existing Tbl_CustomersTableAdapter. That will then allow you to create a GetDataBy... method, which you can use in the same way as the existing GetData() method, only you'll have the addition of being able to pass a parameter to it.

Which would then allow you to do something like:
Dim adap As New DataSet1TableAdapters.CustomerTableAdapter
Dim table As DataSet1.CustomerDataTable = adap.GetDataByLastName("smith")

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SqueezeOJAuthor Commented:
Thanks!

I simply recreated the "query" using the same SQL through the Add --> Table Adapter wizard in the .xsd area.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.