Reputation: 1
I am returning SQL results. First I guess should I be using the reader or the adapter? Second I want to output the results to a table (I cant use a GridView because of other functions going on in the page). So I am wondering How would I go about building my own table and populating with Data from mySQL database. I cant find anything that tells me how to output to what I want. I find textboxes, labels, files etc. but not inline html? I am using ASP.net and C#
Thanks
Upvotes: 0
Views: 1849
Reputation: 88074
Another option is to use a repeater control for emitting the data. Clean, easy, and you have full control of the markup generated.
Here's an example: http://www.aspcode.net/ASPNET-Repeater-control-instead-of-grid.aspx
Upvotes: 1
Reputation: 9338
Reader will be faster than adapter, you will get better performance and your life will get more complicated once you start creating your own grid using html table.
If you don't want to write a lot of code, then use adapter as you will get DataTable which you can easily loop through and build your own html table.
What you are looking for is: System.Web.UI.HtmlControls namespace.
You can build HtmlTable and render it to page. Take a look at this example: Creating HTML Table...
Also, you may want to look at HtmlGenericControl where you can create any element you want like: new HtmlGenericControl("div");
Upvotes: 2