Data insert in SQL server in asp.net c#

Veröffentlicht am: 09 August 2017
auf dem Kanal: Dawood Anwar
64
0

Connecting with SQL server (2008,2010,2012,2014) in Asp.net and Desktop windows Application. Method is so simple you can connect in both ways. first of all creating a form then take a Text Box and a button then go to design and double click on button.
add two classes

using System.Data;
using System.Data.SqlClient;

then write the code in button click event

SqlCommand cmd = new SqlCommand();

SqlConnection mycon = new SqlConnection();
cmd.Connection = mycon;
mycon.ConnectionString = @"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student;Data Source=PRO-PC\SQLEXPRESS";
mycon.Open();
cmd.CommandText = "insert into student(name)values('"+TextBox1.Text+"')";
cmd.ExecuteNonQuery();
Response.Write("record enter successfully.....");
TextBox1.text="";
mycon.Close();
-----------------------------------------------------
Create a database in server name (student) and make table (Student)
----------------------------------------------------
How to create a Connection String
create and notepade and name it whatever you want and give extension (.udl) and save it. open a new file that you have created select your server then database and click to ok again open that file with notepade and copy
--------------------------------------------
Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student;Data Source=PRO-PC\SQLEXPRESS


Auf dieser Seite können Sie das Online-Video Data insert in SQL server in asp.net c# mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Dawood Anwar 09 August 2017 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 64 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!