Click here to Skip to main content
16,012,316 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends
i have a form with two textboxes and a datagridview that has two columns. Now i want users to be able to fill in as many data as they want into the datagridview, and also enter information such as name and age into the textboxes and when they click on save buton the information along with the datagridview informations should be saved to a table in the sql server db. I.e the name of the person to one column, the age to another column and the datagrid to one column on the same row. Dont know if is possible. But if there is a better way please suggest.thanks
Posted
Comments
Andreas Gieriet 11-Mar-13 19:16pm    
What did you try? What says Google?
How about a little bit effort from your side? You are asking now more than 30 quite basic questions in the last 6 months - one question a week... I strongly suggest to consult some of the many tutorials and answers that are around on these topic.
Andi

1 solution

Make an insert statement function with two parameters name and age
and make statement with select name and age from table


1st statement take data from textbox

C#
insertintotable(textbox1.text,textbox2.text);


and the 2nd statement take data from datatable of select statement

C#
datatable dt=selectnameandage();


then use this ...

C#
datagridview.datasource=dt;


all of that under the save button
 
Share this answer
 

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