Click here to Skip to main content
15,905,232 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello i have 7 text boxes and on each click off the button i want to save the data to single row in data base table so how can i do something like this

What I have tried:

private void button1_Click(object sender, EventArgs e)
        {
CON.Open();
string SQLQUERY = "INSERT INTO table1 (name1,last1,first1,second1,top1,bottom1,last1)VALUES(@text1, @text2, @text3, @text4, @text5, @text6, @text7)";

    next
string SQLQUERY = "INSERT INTO table1 (name2,last2,first2,second2,top2,bottom2,last2)VALUES(@text1, @text2, @text3, @text4, @text5, @text6, @text7)";
Posted
Updated 13-Jun-17 17:59pm
Comments
Richard Deeming 14-Jun-17 17:23pm    
That's a very bad database design. You should normalize it before you go any further.

Description of the database normalization basics[^]

1 solution

try this
string SQLQUERY = "INSERT INTO table1 (name1,last1,first1,second1,top1,bottom1,last1, name2,last2,first2,second2,top2,bottom2,last2)VALUES(@text1, @text2, @text3, @text4, @text5, @text6, @text7, @text1, @text2, @text3, @text4, @text5, @text6, @text7)";
 
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