Try to Build Your Query Like below
string sql = "select * from tablname where 1=1";
if (txtSearchRiskId.Text != "")
{
sql += "fRiskID ='" + txtSearchRiskId.Text + "' and ";
}
if (txtsearchrisksequenceno.Text != "")
{
sql += "fSerialNo like'%" + txtsearchrisksequenceno.Text + "%'and ";
}
if (txtsearchriskplateno.Text != "")
{
sql += "fPlateNo like'%" + txtsearchriskplateno.Text + "%' or fPlateNo_bl like'%" + txtsearchriskplateno.Text + "%'and ";
}
if (txtsearchriskyear.Text != "")
{
sql += "fYear like'%" + txtsearchriskyear.Text + "%'and ";
}
if (txtsearchriskchassisno.Text != "")
{
sql += "fChassisNo like'%" + txtsearchriskchassisno.Text + "%'and ";
}
if (txtsearchriskcustomid.Text != "")
{
sql += "fCustomID like'%" + txtsearchriskcustomid.Text + "%'and ";
}
if (ddlsearchRiskTypeCodevalue.SelectedIndex > 0)
{
sql += "fVehicleTypevalue like'%" + ddlsearchRiskTypeCodevalue.SelectedItem.Value + "%'and ";
}
if (ddlsearchRiskmakevalue.SelectedIndex > 0)
{
sql += "fMakevalue like'%" + ddlsearchRiskmakevalue.SelectedItem.Value + "%'and ";
}
if (ddlsearchRiskmodelvalue.SelectedIndex > 0)
{
sql += "fModelvalue like'%" + ddlsearchRiskmodelvalue.SelectedItem.Value + "%'";
}