How to display the dynamic data from database and show in asp.net page without using data controls? [Resolved]

Posted by Prabu_Spark under ASP.NET on 5/6/2014 | Points: 10 | Views : 666 | Status : [Member] | Replies : 4
Prabu JPrabu J

Beginner
54 Points 22 Posts
How to display the dynamic data from database and show in asp.net page without using data controls?

May 6 2014 1:38AM | Link

Hi sir,

Tell me the steps to display the dynamic data from database and show in asp.net page without using data controls. I have a table below.



eid ename esalary

1 Abhi 5000

2 Bala 8000

3 Chithra 6000



[Note: I need to show the datas fetch from db without using any data controls in asp.net]

Kindly give me the solution for this problem.

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Chandradev819 on: 5/6/2014 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi

You can try like this

StringBuilder strResults = new StringBuilder();

strResults.Append("<table>");


for (int i = 0; i <= ds.tables(0).rows.Count; i++) {
strResults.Append("<tr>");

strResults.Append("<td>");
strResults.Append(ds.tables(0).rows(i)("ColumnName"));

strResults.Append("</td>");

strResults.Append("<tr>");

}

strResults.Append("</table>");

divResults.innerHTML = strResults.ToString();


Thanks and Regards
Chandradev
My Blog

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chandradev819 on: 5/6/2014 [Member] Starter | Points: 25

Up
0
Down
You can do like this

StringBuilder strResults = new StringBuilder();


strResults.Append("<table>");


for (int i = 0; i <= ds.tables(0).rows.Count; i++) {
strResults.Append("<tr>");

strResults.Append("<td>");
strResults.Append(ds.tables(0).rows(i)("ColumnName"));

strResults.Append("</td>");

strResults.Append("<tr>");

}

strResults.Append("</table>");

divResults.innerHTML = strResults.ToString();


Thanks and Regards
Chandradev
My Blog

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabu_Spark on: 5/6/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,
What type of object does divResults belongs to. You did not declare that.

With regards,
J.Prabu.
[Email:prbspark@gmail.com]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chandradev819 on: 5/6/2014 [Member] Starter | Points: 25

Up
0
Down
Hi

divResults is the Name of Div.

Thanks and Regards
Chandradev
My Blog

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response