James James - 8 months ago 37
SQL Question

How to get SQL Query from a view in VB.NET

I have a database in my sql server and I also created one view in it to store a really long, I mean a really long query. And I need to use this query to fill a SqlDataAdapter in VB

Basic example with very straight easy query on how to fill a SqlDataAdapter

adapter.Fill("Select * from products")

I only wish my query was this simple and straight forward, instead i have a monster of a query and dont't want / cant't just paste it in my code. Isn't there another way to access it like so:


The Dataset here contains my View



This was posted as a question in a comment, so I will convert it to an answer. Select directly from the view.

Select * FROM <myViewName>