string sSQL = "SELECT P.Part_NO,u.Unit_Code,u.Unit_Name,p.Unit_Rate FROM PARTUNITRATE P,UNITFLM U WHERE P.UNIT_CODE=U.Unit_Code and p.part_no='{0}'";
ServiceSysmBLL.SysmBLL sysmBLL = new ServiceSysmBLL.SysmBLL();
DataSet ds=sysmBLL.RunSQLQuery_RunSQL(string.Format (sSQL, Key));
DataColumn[] keyObj = new DataColumn[1];
keyObj[0] = ds.Tables[0].Columns["Unit_Code"];
ds.Tables[0].PrimaryKey = keyObj;
dataGridView1.DataSource = ds;
dataGridView1.DataMember = ds.Tables[0].TableName;
错误信息提示:
private void dataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs anError)
{
if (anError.Context == DataGridViewDataErrorContexts.Commit)
{
}
if ((anError.Exception) is ConstraintException)
{
MsgErr("您好,单位不能重复设置!", m_FormID);
anError.ThrowException = false;
}
}