string connstr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + @".\TestDoc\db1.mdb;";
OleDbConnection conn = new OleDbConnection(connstr);
string sqlstr = "select name from work";
da = new OleDbDataAdapter(sqlstr, conn);
ds = new DataSet();
da.Fill(ds);
if(ds.Tables[0].Rows.Count > 0)]
{
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
if(ds.Tables[0].Rows[i]["name"].ToString() == "JT")}//遍历取得name判断逻辑
{
//TO do somthing here
} }
}
{
sqlcommand cmd =new sqlcommand ("select * from work where name='"+ 某一个字段 +"'",con);
sqldatareader sdr=cmd.excutereader()
if(sdr.read())
{
session["name"]=sdr["name"];
if(session["name"].... //比较
{ }
}
}
不知道符合你意思不?