string sqlstr = "select a1,a2,a3 from tablename";
OleDbCommand cmd;
try
{
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
cmd = new OleDbCommand(sqlstr, conn);
}
catch (OleDbException ex)
{
throw new Exception("执行SQL语句失败!!" + ex.ToString());
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
//表格方式
OleDbDataAdapter da = new OleDbDataAdapter(sqlstr, mysqlcn);
DataSet ds = new DataSet();
if (da.Fill(ds) > 0) //
{
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
不知道你的一列数组是怎么存储的,分布在多个表中还是一个表中,有没有更明确的要求?
你都连接好了
用查询查出来
用循环赋值不就行了