select GatePassNo, CheckIN_Date,Customer_Name,State,
City,Customer_Location from Product_Details
where ( Customer_Name='"+ddlCName.SelectedItem.Value+"'
or State='"+DropDownList2.SelectedItem.Value+"'
or City='"+DropDownList3.SelectedItem.Value+"'
or Status='"+DropDownList1.SelectedItem.Value+"'
or GatePassNo='"+ddlCGatePassNo.SelectedItem.Value+"')
I'll not criticize the way you are building this query, but at least it is better looking that way. Now as a solution, perhaps there is a null value on one of those dropdowns?
string sql = "select GatePassNo, CheckIN_Date,Customer_Name,State, " +
"City,Customer_Location from Product_Details " +
"where ( 1=1 " +
ddlCName.SelectedItem.Value != null ? " " : ("or Customer_Name='" + ddlCName.SelectedItem.Value + "' ") +
DropDownList2.SelectedItem.Value != null ? " " : ("or State='" + DropDownList2.SelectedItem.Value + "' ") +
DropDownList3.SelectedItem.Value != null ? " " : ("or City='" + DropDownList3.SelectedItem.Value + "' ") +
DropDownList1.SelectedItem.Value != null ? " " : ("or Status='" + DropDownList1.SelectedItem.Value + "' ") +
ddlCGatePassNo.SelectedItem.Value != null ? " " : ("or GatePassNo='" + ddlCGatePassNo.SelectedItem.Value + "')");