Technologies
Technologies
Technologies
580.2k 32 7
WindowsFormsApplication4.zip
Initial chamber
Step 1: Open Visual Studio 2010. Go to File, New, Projects and under Visual C# select Windows.
window form
You can change the name of the project and browse your project to different location too. And then
press OK
Step 2: In Solution Explorer you will get your Project Add Service Based Database by going to your
Project. Right click and Add New Item, then select Service-based Database.
Database chamber
Step 3: Go to your Database Database.mdf and we will create a table tbl_save. Go to the database.mdf,
then Table and Add New table. Design your table like the following screenshot:
Tbl_save:
Table
Design chamber
Step 4: Now open your Form1.cs file, where we create our design for inserting data into the database.
We will drag three labels, three textbox and one button from the tool box to Form1.cs. You will see your
Form look like the following screenshot:
Form1.cs [design]:
form
Code chamber
Right click on the blank part of Form1.cs, then click View Code. You can see you are entered in the code
part of the form. Write the following code and then Press F5 to run the project.
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Insert_data_into_table
public Form1()
InitializeComponent();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@name", textBox1.Text);
cmd.Parameters.AddWithValue("@email", textBox2.Text);
cmd.Parameters.AddWithValue("@phone", textBox3.Text);
cmd.Parameters.AddWithValue("@address", textBox4.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
if (i!=0)
{
Application.Run(new Form1());
Output chamber
Output
C# Corner Ebook
Download Now!
SIMILAR ARTICLES
http://nileshjadav.blogspot.in/https://www.youtube.com/c/nileshkumarJadav/
8115.2m2
32
Type your comment here and press Enter Key (Minimum 10 characters)
About Us Contact Us Privacy Policy Terms Media Kit Sitemap Report a Bug FAQ Partners
Web3 Universe Build with JavaScript Let's React DB Talks Jumpstart Blockchain Interviews.help
የመጀመሪያው ጽሁፍ