数据库读取数据并赋给一个arraylist
lc12d 2008-04-28 03:45:43 string connectionString = ConfigurationManager.ConnectionStrings["SQLServer"].ConnectionString;
SqlConnection Connection = new SqlConnection(connectionString);
Connection.Open(); //联接打开
string zjid = "select id from [zj_trainlog] where tid='" + tid.Text + "'";
SqlCommand myCommand1 = new SqlCommand(zjid, Connection);
myCommand1.CommandType = CommandType.Text;
SqlDataAdapter myda = new SqlDataAdapter();
myda.SelectCommand = myCommand1;
DataSet ds = new DataSet();
myda.Fill(ds, "news");
Connection.Close();
length = Convert.ToInt32(ds.Tables[0].Rows.Count);
// Response.Write(length);
for (i = 0; i < length;i++ )
{
arrayList.Add(ds.Tables["news"].Rows[i].ToString());
Response.Write(ds.Tables["news"].Rows[i].ToString());
}
怎么ds.Tables["news"].Rows[i].ToString()的值是这些东西啊
System.Data.DataRowSystem.Data.DataRowSystem.Data.DataRowSystem.Data.DataRow
那我想把数据库读出的内容赋给一个arraylist该怎么实现呢。请教了