protected void btnaddcontact_Click(object sender, EventArgs e)
{
foreach (GridViewRow g1 in gvcheckdata.Rows)
{
SqlConnection con = new SqlConnection("Data Source=ANOCRM-PC\\SQLEXPRESS1;Initial Catalog=anosalescrm;Integrated Security=True");
SqlCommand com = new SqlCommand("insert into savetodb select [SrNo] ,[CompanyName],[CompanyWebsite],'" + g1.Cells[0].Text + "' as FirstName,'" + g1.Cells[1].Text + "' as MiddleName,'" + g1.Cells[2].Text + "' as LastName,'" + g1.Cells[4].Text + "' as Title,'" + g1.Cells[3].Text + "' as Email ,'" + g1.Cells[5].Text + "' as DirectPhone,[CorporatePhone],[Fax] ,[Address1],[Address2],[Country] ,[State] ,[City] ,[Countrycode] ,[ZipCode],[Industry] ,[Employees],[Revenue],'" + g1.Cells[8].Text + "'as Result , '" + g1.Cells[9].Text + "' as Comment ,'" + g1.Cells[6].Text + "' as Level,'" + g1.Cells[7].Text + "' as FunctionalArea,[Projectid] ,GETDATE(),'" + Session["MemberId"] + "' as memberid ,null from (select top 1 * from savetodb where CompanyName='" + Session["CompanyName"] + "' and SrNo= " + Session["SrNo"] + "and Projectid= " + Session["projectid"] + ")t", con);
con.Open();
com.ExecuteNonQuery();
con.Close();
}
Label21.Text = "Records inserted successfully";
}