本文介绍了遍历数据库表的cols的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.我有问题请帮帮我.
我的数据库表中有三个cols分别是col1,col2和col3.我希望当用户单击按钮时,for循环将这些列的值一个接一个地显示在网页上.有人可以告诉我该怎么做吗?我在C#中使用asp.net.预先感谢.

hi everybody.i have some problem please help me.
i have three cols in my database table named col1,col2,and col3. i want that when user clicks on a button the a for loop takes the values of these cols one by one and show it on the web page. can some body tell me how to do it. i m using asp.net with c#. thanks in advance.

推荐答案


foreach(DataColumn col in ds.Tables[0].Columns)
{
  Console.WriteLine("{0} = {1}", column, column.DataType);
}



[您的问题不清楚.请改善您的问题.]



[Your question is not clear. Please Improve you questions.]


这篇关于遍历数据库表的cols的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 18:22