Add button code as follows
Sql = "select cpm_pkg_id from CO_PACKAGE_MASTER where cpm_pkg_name = '" + txtpkgdesc.Text.ToString().Trim() + "' ";
dt1 = SCon.ReadSql_DT(Sql);
if(dt1.Rows.Count>0)
{
Sql ="Insert into CO_PACKAGE_DETAIL values('" + dt1.Rows[0]["cpm_pkg_id"].ToString() + "','" + gvmajormaster.selectedrow(1].tostring.trim() + "','" + gvmajormaster.selectedrows[2].tostring().trim() + "')";
SCon.ExecSql(Sql);
lblErr.Text = "Package details inserted successfully";
}
In gridview as follows
Select Major Code Minor Code
PSTF AFF
i want to insert the above gridview row values PSTF (Major code) and AFF(Minor Code) into co_package detail.
i tried the below code but shows error as follows
Object reference not set to an instance of an object.