cmd.CommandText = "Select * From [Archive] Where ProductID LIKE @id AND [Name] ='"+null+"'";
اینم مثال خوبیه
try
{
FormatGrid();
OleDbConnection con = new OleDbConnection(path);
con.Open();
//OleDbDataAdapter da = new OleDbDataAdapter("Select * from ItemMast where Icode like '" + txtICode.Text.Trim() + "%' order by Iname", con);
OleDbDataAdapter da = new OleDbDataAdapter("Select * from ItemMast where IName like '" + txtICode.Text.Trim() + "%' order by IName", con);
DataSet ds = new DataSet();
da.Fill(ds, "ItemMast");
DataTable dt = ds.Tables["ItemMast"];
if (dt.Rows.Count > 0)
{
int i = 1;
MSGrid1.Rows = dt.Rows.Count + 1;
foreach (DataRow dr in dt.Rows)
{
MSGrid1.set_TextMatrix(i, 0, i.ToString());
MSGrid1.set_TextMatrix(i, 1, dr["ICode"].ToString());
MSGrid1.set_TextMatrix(i, 2, dr["IName"].ToString());
MSGrid1.set_TextMatrix(i, 3, dr["SubSubGroupName"].ToString());
MSGrid1.set_TextMatrix(i, 4, dr["GroupName"].ToString());
MSGrid1.set_TextMatrix(i, 5, dr["SubGroupName"].ToString());
//MSGrid1.set_TextMatrix(i, 4, dr["ICode"].ToString());
//MSGrid1.set_TextMatrix(i, 3, dr["AvlQty"].ToString());
double st1 = double.Parse(dr["AvlQty"].ToString());
if (CheckDecimal(st1) == false)
MSGrid1.set_TextMatrix(i, 6, st1.ToString("0"));
else
MSGrid1.set_TextMatrix(i, 6, st1.ToString());
i = i + 1;
}
}
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
و این
string rowHostName = row.Cells["HostName"].Value.ToString();
string rowUsers = row.Cells["Users"].Value.ToString();
string rowPSName= row.Cells["PS_NAME"].Value.ToString();
if (arrHostName.Contains(rowHostName)
|| arrUsers.Contains(rowUsers)
|| arrPSName.Contains(rowPSName))
{
row.Appearance.BackColor = Color.Yellow;
row.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
}
توسط
Dany
(7,164 امتیاز)
●4 ●7 ●141