平时我们在DATASET里直接定义好,或者取ROW几就OK了。。现在这个找多主键的例子!
string str_cn=System.Configuration.ConfigurationSettings.AppSettings["zlinc"];
OracleConnection orcn=new OracleConnection(str_cn);
string str_sql="select * from archives where isdelete='0'";
OracleDataAdapter da=new OracleDataAdapter(str_sql,orcn);
DataSet ds=new DataSet();
da.Fill(ds,"archives");
DataTable dt=ds.Tables["archives"]; //定义TABLE
dt.PrimaryKey=new DataColumn[] {dt.Columns["governid"],dt.Columns["archivesno"]}; //定义PK!!
object[] ob=new object[2] {"330702001006","55"}; //定义PK的值!
DataRow dr=dt.Rows.Find(ob); //得到根据PK,得到ROW
this.TextBox1.Text=dr["note"].ToString(); //得到值!
this.TextBox2.Text=dr["adddate"].ToString();