what is datatable,you mean table running on server?
解决方案 »
- 如何取出GridView中的下拉列表中的值?
- ●●●●关于C# Socket编程 ---高手进●●●● -------在线
- 急急急!!!!请前辈帮忙!!!在线等!!!!
- dataset
- ~~~~~~~~~这两个方法返回的结果为什么不一样?
- 如何在一行显示多个图片?
- access中一个三表查询的问题!
- 如何用CustomValidator来验证listbox
- .net的数据同步更新问题,期望大家给以解释。
- 运算符对 类型“DBNull” 和 类型“Integer” 无效。(没分给了,大家帮帮忙啊!)
- 在线等候解决:datagrid中如何实现新增记录?
- 高分征集,遍历文件内容的程序????????
you can use sqldatareader
while(sdr.Read())
{
TableRow tr=new TableRow();
TableCell tc1=new TableCell();
TableCell tc2=new TableCell();
tc1.Text=sdr.GetValue(0).ToString();
if(sdr.Read())
tc2.Text=sdr.GetValue(0).ToString();
tr.Cells.Add(tc1);
tr.Cells.Add(tc2);
this.Table1.Rows.Add(tr);
}
SqlConnection cn = new SqlConnection(数据库连接字符串);
SqlDataAdapter da = new SqlDataAdapter(strSql,cn);
DataTable dt = new DataTable();
da.Fill(dt);DataGrid1.DataSource = dt.DefaultView;
DataGrid1.DataBind();
selectCMD.CommandTimeout = 30;SqlDataAdapter custDA = new SqlDataAdapter();
custDA.SelectCommand = selectCMD;nwindConn.Open();DataSet custDS = new DataSet();
custDA.Fill(custDS, "Customers");nwindConn.Close();