My code:
public DataTable SearchStudent_Number()
{
Connection C1 = new Connection();
return C1.ShowData("select * from Student where Student_Number like '" + this.Student_Number + "%'");
}
public DataTable SearchAverage()
{
Connection C1 = new Connection();
return C1.ShowData("select * from Student where Average like '" + this.Average + "%' ");
}
public DataTable SearchLastName()
{
Connection C1 = new Connection();
return C1.ShowData("select * from Student where LastName like '" + this.LastName + "%'");
}
public DataTable SearchField()
{
Connection C1 = new Connection();
return C1.ShowData("select * from Student where Field like '" + this.Field + "%'");
}
public DataTable SearchStudent_ID()
{
Connection C1 = new Connection();
return C1.ShowData("select * from Student where Student_ID like '" + this.Student_ID + "%'");
}
}
}
Loading

Joe WilsonPosted Jul 13, 2014, 1:31 AM
Guest UserPosted Jul 12, 2014, 9:46 PM
SearchFunction(Average , this.Average);
Average ==> columnName
this.Average==>I assume this is class in you Model where you've value for it
OR pass like this if you know exact value
SearchFunction(Average , 20);
twitter @sumitjolly
Joe WilsonPosted Jul 9, 2014, 2:59 PM
Did my answer have problem?
Guest UserPosted Jul 8, 2014, 2:12 AM
public DataTable SearchFunction(string column, string colValue)
{
Connection C1 = new Connection();
return C1.ShowData("select * from Student where "+column +" like '" + colValue + "%'");
}
Now to call this function can be done as
SearchFunction(Average , this.Average);
twitter @sumitjolly