hmmm, why not just bind the entire result set to a datagrid?? You could do something like this:
private void someMethod(){
string sqlcmd = "SELECT [data] FROM [table]";
DataTable dt = new DataTable();
dt = getDataTable();
datagrid.DataSource = dt;
datagrid.DataBind();
}
private DataTable getDataTable(string sqlcmd)
{
DataTable dt = new DataTable();
sqlConn = new SqlConnection([connection string]);
cmd = new SqlCommand(sqlcmd, sqlConn);
daSql = new SqlDataAdapter(sqlcmd, sqlConn);
daSql.Fill(dt);
return dt;
}
where daSql = DataAdapter
cmd = SqlCommand
sqlConn = SqlConnection
hth
"The one language all programmers understand is profanity."
|