我希望用户提供2个或更多可用于查询的where子句的参数。最好和最安全的方法(避免sql注入)是什么?
查询可能看起来像这样:
private async void repositoryItemButtonEdit1_Click(object sender, EventArgs e)
{
XtraMessageBox.AllowCustomLookAndFeel = true;
DialogResult dr= XtraMessageBox.Show("آیا از تایید این سفارش ممئن هستید ؟"+"\n"+"با این کار کاربر در آپ ناتیفیکیشن تایید دریافت می کند", "آیا مطمئن هستید ؟", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(dr==DialogResult.Yes)
{
progressPanel1.Visible = true;
int id = Int32.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "id").ToString());
string pid = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "pusheid").ToString();
int iu=await sendnotification(id, pid, "تایید");
await wbs.UpdateOrderTblAsync(id, "تایید شد");
XtraMessageBox.AllowCustomLookAndFeel = true;
XtraMessageBox.Show("سفارش تایید و از طریق ناتیفیکیشن به کاربر اطلاع رسانی شد", "موفقیت", MessageBoxButtons.OK, MessageBoxIcon.Information);
sqlDataSource1.Fill();
progressPanel1.Visible = false;
}
}
或者可能是:
"select * from table where id in (x1,x2);"