I have created some views of the select join query in sql server 2005.
I want to make use of this views with the asp.net 2005 with C# code.
I m using SQLDATASOURCE to retrieve data from sqlserver.
Can anyone help me how to write in C#
VIEW
SELECTCAST(LEFT(SalesReturnDate, 11)AS datetime)AS Date,SUM(TotalAmount)AS SalesreturnFROM dbo.dfh_SalesReturnHeaderGROUP BYCAST(LEFT(SalesReturnDate, 11)AS datetime)
This is the sample view how to connect it with asp.net C#,sqldatsource of 2005
Thanxs in adv.
Hi Krish,
Lets call your view as uvw_SalesReturns
You use it like a table
You can give a sql command text or create a stored procedure containing the statement and then call the stored procedure
Sql statement is
select [Date], SalesReturn From uvw_SalesReturns
You can edit the sqldatasource and give this sql statement.
Or you can open an sqlconnection and call an sqlcommand to do it yourself without using sqldatasource if you have N-Tier Architecture.
Happy programming,
Anton
No comments:
Post a Comment