//建立并打开数据库连接
OleDbConnection conn=new OleDbConnection().
conn.ConnectionString=strConnectionString.//strConnectionString为数据库连接字符串
conn.Open().
string sql="0select * from NewsClass order by ClassId desc".
string x.
DataSet ds=new DataSet().
OleDbDataAdapter da=new OleDbDataAdapter(sql,conn).
da.Fill(ds,"NewsTable").
DataTable dt=ds.Tables["NewsTable"].
x=dt.Rows[i][1].ToString()//数据表i行j列的值
conn.close().
|