NET C# How to retrieve data from database using SelectCommand in Code Behind
Posted on 2006-03-21
Currently I doing ok fetching data from the database and displaying same in gridview using following SELECT code in my (HTML) aspx file:
selectcommand="SELECT LastName FROM Employees WHERE Title= @Title">
<asp:Parameter name="Title" controlid="DropDownList1" propertyname="SelectedValue"/>
And in my aspx.cs (behindcode) I set the user's input search @ parameters something like have something like
Within my Page_Load, I have something like:
C#: productDataSource1.SelectParameters["Title"].DefaultValue = strTitles;
However, now in my codebehind I need to retrieve the same data retrieved from database and currently displayed in gridview and pass this same retrieved data (all the gridview records) into a piece of code which is suppose to print all the gridview row records to an EXCEL file by clicking a printbutton on located the gridview page?
NET C# Again, in code behind - How do I go about passing the same retrieved data records stream to a print
Excel routine located in my codehind file.