Click here to Skip to main content
15,890,370 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I really need help here I am new at this work using Microsoft Visual Studio 2010.
So here are my problems:

1. How can I add data to my SQL database using textboxes and button
For example,
Data source name: RightDataSet
Table name: infotable
Columns: ID, Last Name, First Name
So the ID here is in autoincrement, so I only need 2 textboxes and a button in my form named textbox1, textbox2 and button1.


2. If my problem 1 is solved, another problem occurs. I want to display the maximum value in ID column to a textbox in a form using a button to display it in that textbox.

Thank You For Your Answers In Advance. I am making an enrollment program

What I have tried:

I tried searching for codes but none of them is working.
Posted
Updated 24-Sep-16 20:58pm
Comments
Karthik_Mahalingam 25-Sep-16 1:43am    
SQL or MYSQL ?

Most likely you won't find exact code that suits your needs. Instead you need to understand and learn each step for making the program. After all programming isn't about copying.

As said break the problem into smaller pieces. Taken this is SQL Server:
1. Draw the form, add necessary elements to it and give them proper names. Don't use Textbox1 but names like LastName.
2. Create the code for connecting into database and executing the INSERT statement. You can for example read through Properly executing database operations[^]
3. To return the newly added key value use the OUTPUT clause[^]

While creating each piece of the program, take your time, explore and observe the different possibilities how to do things, make slight modifications to see how they affect and always utilize the debugger to understand the behaviour: Navigating through Code with the Debugger[^]
 
Share this answer
 
Comments
†Disk4rGA† 25-Sep-16 3:02am    
thanks... i really need help now for the deadline is near.... i was discovering for the codes for about a month now and got it right but it was corrupted or something and it is not working now :(
 
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