Please provide with an example.so,it helps me a lot
create sql srver view and how to retrive the data in asp.net
how to create a sql server view and retrieve data by using asp.net c#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjeeb LenkaPosted Aug 30, 2013, 12:58 AM
SQL View is nothing but a virtual table which contains are defined by sql query.
Example:
CREATE VIEW DEPTVIEW
AS
SELECT * FROM DEPT
now a simple view is created. you can use it in front end as a normal table.
sample:
DataTable t = new DataTable();
using (SqlConnection c = new SqlConnection(connectionstring))
{
using (SqlDataAdapter a = new SqlDataAdapter("SELECT * FROM DEPTVIEW", c))
{
a.Fill(t);
}
}
gridview1.DataSource=t;
gridview1.DataBind();