parthiban karnan

parthiban karnan

  • NA
  • 549
  • 99.8k

how to catch username into db on apply job module

Dec 3 2014 1:04 AM
got a scenario to search job and apply for registered users.on login user can  search and  apply for particular job selected from gridview. selected grid row data[selected job] get stored in db, but not into particular user module, who apply.
 
 everthing works fine when user logs and apply[select particular grid row value] to db, but i am not able to catch username to table along with selected gridview row value.
 
 
do i have to add username column in jobs_applied table, which reflects from jobs_posting table gridview. then how to save user details[username] to table.

below is my code

for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
{

string job_code = GridView1.Rows[i].Cells[1].Text;
string Company_name = GridView1.Rows[i].Cells[2].Text;
string Designation = GridView1.Rows[i].Cells[3].Text;
string Qualification = GridView1.Rows[i].Cells[4].Text;
string Experience = GridView1.Rows[i].Cells[5].Text;
string Salary = GridView1.Rows[i].Cells[6].Text;
string Location = GridView1.Rows[i].Cells[7].Text;
string Industry = GridView1.Rows[i].Cells[8].Text;
string job_role = GridView1.Rows[i].Cells[9].Text;
// Txtusername.Text = theRow[13].ToString();
// string user = GridView1.Rows[i].Cells[10].Text;





GridViewRow row = GridView1.Rows[i];
CheckBox Chbox = (CheckBox)row.FindControl("chb1");
if (Chbox.Checked == true)
{
InsertData( job_code, Company_name, Designation, Qualification, Experience, Salary, Location, Industry, job_role);
}

}
Response.Write("Record inserted successfully");

}

void InsertData( String job_code, String Company_name, string Designation, string Qualification, string Experience, string Salary, string Location, string Industry, string Job_Role)
{
SqlConnection con = new SqlConnection(connStr);
try
{
con.Open();
com = new SqlCommand("insert into billava_jobpostingss values('" + job_code + "','" + Company_name + "','" + Designation + "' ,'" + Qualification + "','" + Experience + "','" + Salary + "','" + Location + "','" + Industry + "','" + Job_Role + "')", con);
com.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}