Key:
DataColumn MyTmpCol;
DataColumn[] MyKey=new DataColumn[1];
Tab.PrimaryKey = MyKey;
DataRow TmpRow = Checked_Fitting_Tab.Rows.Find(this.GUIDLab.Text);
TmpRow[8] = Convert.ToString(this.使用数量.Value);
TmpRow[9] = this.小计金额.Text;
TmpRow.AcceptChanges();
Checked_Fitting_Tab.PrimaryKey = null;
Checked_Fitting_Tab.ImportRow(TmpRow);
Select:
System.Data.DataSet dbset = new DataSet();
string linkstr = @"Integrated Security=SSPI;server=127.0.0.1";
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(linkstr);
con.Open();
string sqlstr = "select * from mytest.dbo.info";
System.Data.SqlClient.SqlDataAdapter adp = new System.Data.SqlClient.SqlDataAdapter(sqlstr,con);
adp.Fill(dbset);
con.Close();
con.Dispose();
adp.Dispose();
//string:
string str = "张";
DataRow[] srow = dbset.Tables[0].Select("姓名 like '%"+str+ "%'");
//Number:
Int32 Num= 29;
DataRow[] srow = dbset.Tables[0].Select("年龄>" +Num );
//Guid:
string str = "AA5F76F3-9944-4C00-BC6C-D60B3666D20D";
DataRow[] srow = dbset.Tables[0].Select("唯一识别= '" + str + "'");
//Data:
string str = "2004-8-12";
DataRow[] srow = dbset.Tables[0].Select("到岗日期= #" + str + "#");
//Data B:
//数据库字段使用nvarchar
string str1 = "12:00:00";
DataRow[] srow = dbset.Tables[0].Select("到岗时间>#" + str1 + "#");