public DataSet Find(String str) { if (str == "") throw new Exception("Please provide ID to search"); DataSet ds = null; Dal objdal = new Dal(); ds = objdal.FindRecord(RollNumber); return ds; }
public DataSet FindRecord(int RollNumber) { DataSet ds = null; try { string command = "Select * from tblstudent where RollNumber=@RollNumber"; using (SqlConnection con = new SqlConnection(cs)) { con.Open(); SqlDataAdapter da = new SqlDataAdapter("command", con); ds = new DataSet(); da.Fill(ds, "tblstudent"); con.Close(); } } catch (Exception e) { string st = e.Message; } return ds; }
int RollNumber = Convert.ToInt32(str); ds = objdal.FindRecord(RollNumber);
Public DataSet FindRecord(int RollNumber) { try{ string command="select * from tblstudent Where rollnumber=@ROLLNUMBER"; using(sqlcommand cmd=new sqlcommand(command,con){ cmd.parameters.add("@ROLLNUMBER", SqlDbType.Int32)=ROLLNUMBER; sqldataadapter da=new sqldataadapter(cmd); dataset ds=new dataset(); da.fill(ds); return ds; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)