c# winform 用OracleDataAdapter的来处理语句,非拼接语句,非SQL拼凑

OracleConnection conn = dbc.getConnection();//获得conn连接

try
{
	DataTable dt = new DataTable();
	//注:bz为违法行为字段
	OracleDataAdapter sda = new OracleDataAdapter("SELECT xh,hpzl,hphm,bz,larq,fdjh,clpp,cjh,jdcsyr,cllx,csys FROM kk.kkhmd WHERE 1 = 1  " + hphm + " ",conn);//查询黑名单表

	if (checkBox1.Checked == true)
	{
		sda.SelectCommand.Parameters.Add("textBox1", 	OracleType.VarChar).Value = textBox1.Text;//给hphm传参
	}
	else
	{
	
	}

	sda.Fill(dt);
	dataGridView1.DataSource = dt;
}
catch (Exception ee)
{
	MessageBox.Show(ee.Message.ToString());
}


黑色头发:http://heisetoufa.iteye.com

你可能感兴趣的:(sql,C++,c,C#,WinForm)