ADO.NET

ADO.NET Projects

ADO.NET Project 1

ADO.NET Examples

Examples

Inserts (Create) a new table in ASP .Net using C#
Previous Home Next
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection newConnection = new 
SqlConnection(@"Data Source=R4R-3EFD13BB468\SQLEXPRESS;
initial catalog=newDatabase;integrated security=true;");
protected void Page_Load(object sender, EventArgs e)
{
newConnection.Open();
SqlCommand cmd = new 
SqlCommand
("create table Emp_Login (UserName nvarchar(20), Password nvarchar(20))"+
"insert into Emp_Login (UserName,Password) values ('atul','1234');",
newConnection);
cmd.ExecuteNonQuery();
newConnection.Close();
}
}

 

OutPut:

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: