Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ,
I have a problem in my code.
In my code there are two part job type and its details.
for one job type there are many details.
After click on add button Each detail is display in gridview .
similarly we can add many details.
on click of submit button i wants to save all details of job type into jobtype table as well as update the details table by inserting jobtype code into it.
can anyone help me plz...
thank you.
Posted
Comments
Member 11559407 20-Oct-15 8:30am    
post ur coding

C#
<pre lang="c#">

foreach(datatgridview gr in datagridview1.rows)
{
     insert into table name values('"+gr.cells[0].value+"','"+gr.cells[1].value+"','"+gr.cells[2].values+"');
cmd.ExicuteNonQuery();
)
}
 
Share this answer
 
Comments
asplover1 20-Oct-15 23:48pm    
Thanx for reply . I think it will help me. Could plz solve my this error?
on 'foreach(datatgridview gr in datagridview1.rows)' it give error 'datatgridview is a field but use as type'
Send your only datagridview code including this code which I had send it before . I think you write in wrong place
 
Share this answer
 
Comments
asplover1 22-Oct-15 2:24am    
Hey I solve this problem uing this code.
for (int i = 0; i < grdvwAdd.Rows.Count - 1; i++)
{

cmd.CommandText = "UPDATE JobTypeDetails SET jobType_id = '"+tbxCode.Text.Trim()+"' WHERE (JobTypeDetail_id = '" + Convert.ToInt32(grdvwAdd.Rows[i].Cells[0].Text) + "')";

cmd.CommandType = CommandType.Text;
cmd.Connection = con;
try
{
con.Open();
int result = cmd.ExecuteNonQuery();
}
asplover1 16-Nov-15 4:55am    
Hi,I wants to delete this virtual grid view on click on clear button. Could you please help me..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900