我今天自己在网上请教高人问题解决了,贴上来给大家共享吧
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//查询
private void serch_Click(object sender, EventArgs e)
{
char[] sep = { ',', ',' };
StringBuilder strbSql = new StringBuilder();
strbSql.Append("select pronumber,proinfo,probackinfo,id from sys_product
where ");
string[] strKeys = pronumber.Text.Trim().Split(sep);
foreach (string item in strKeys)
{
if (item.Trim().Length > 0)
{
strbSql.AppendFormat("pronumber ='{0}' or ", item.Trim());
}
}
string strSql = strbSql.ToString().Substring(0, strbSql.ToString().Length - 4);
//
MessageBox.Show(strSql);
string sqlsel = strSql;
DataTable dt = bangding(sqlsel);
cmAmend = (CurrencyManager)BindingContext[dt];
this.dataGridView1.DataSource = dt;
}