I have the below ADO.Net code written in c# to get the detail of the student from the student table when the user puts either the roll number or the student name. The problem is that, it was all fine when the search was being performed using only one column but I want to use either condition on columns. Does anybody have any idea if this thing is possible in the below code.The below code is throwing me an error saying:
incorrect syntax near OR.
comm = new SqlCommand("select * from student_detail where (roll_no = '%" + txtRollNumber.Text + "%') OR (s_name = '"+ txtStudentName.Text +"')", conn);