protected void srjobs() { //sql1.Open(); //SqlCommand com = new SqlCommand(str, sql1); //SqlDataAdapter da = new SqlDataAdapter(com); //da.Fill(ds,"hrjob"); dbclass cl = new dbclass(); cl.srchjobs(ds, str); DataTable a1 = new DataTable("a1"); a1.Columns.Add("jobid", typeof(string)); a1.Columns.Add("location", typeof(string)); a1.Columns.Add("jobdetails1", typeof(string)); a1.Columns.Add("jobdetails2", typeof(string)); DataRow drow; int k = ds.Tables["hrjob"].Rows.Count; int l = 0; while (l < k) { drow = a1.NewRow(); drow["jobid"] = ds.Tables["hrjob"].Rows[l]["jobid"]; drow["location"] = ds.Tables["hrjob"].Rows[l]["location"]; drow["jobdetails1"] = ds.Tables["hrjob"].Rows[l]["name"] + ", Min Exp : " + ds.Tables["hrjob"].Rows[l]["exp_req"] + ", Salary : " + ds.Tables["hrjob"].Rows[l]["salary"]; drow["jobdetails2"] = ds.Tables["hrjob"].Rows[l]["position"] + ", Degree : " + ds.Tables["hrjob"].Rows[l]["qual1"] + ", " + ds.Tables["hrjob"].Rows[l]["qual2"] + ", Preferred Skills = " + ds.Tables["hrjob"].Rows[l]["skill1"] + ", " + ds.Tables["hrjob"].Rows[l]["skill2"]; a1.Rows.Add(drow); l++; } if (k == 0 && a == false) { grid.Visible = true; grid.Text = "No Jobs Found."; } if (a == true && k > 0) { grid.Visible = true; grid.Text = "There are " + k + " Jobs in your Network."; } ds.Tables.Add(a1); //ds.Tables["a1"].Columns.Add() = ds.Tables["hr_jobpost"].Columns["location"]; GridView1.DataSource = ds.Tables["a1"]; GridView1.DataBind(); //sql1.Close(); }