web Config For sql server
<add key=”test” value=”data source=servername;uid=”";pwd=”";initial catalog=”"”; Connect Timeout=900;pooling=’true’; Max Pool Size=900;”/>
.aspx.cs page
conn = new SqlConnection(ConfigurationManager.AppSettings["test"]);
conn.Open();
SqlCommand cmd = new SqlCommand(“spregistration”, conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue(“@companyname”, txtcompanyname.Text);
cmd.Parameters.AddWithValue(“@title”, droptitle.Text);
cmd.Parameters.AddWithValue(“@name”, txtname.Text);
cmd.Parameters.AddWithValue(“@designation”, txtdesignation.Text);
cmd.ExecuteNonQuery();
cmd.Connection.Close();
Stored Procedure:
CREATE PROCEDURE spregistration
@companyname varchar (200),
@title varchar (200),
@name varchar (200),
@designation varchar (50)
AS
INSERT INTO [tbl_registration]
(companyname,title,[name],designation)
VALUES (@companyname,@title,@name,@designation)
RETURN
GO
Click Here!
<add key=”test” value=”data source=servername;uid=”";pwd=”";initial catalog=”"”; Connect Timeout=900;pooling=’true’; Max Pool Size=900;”/>
.aspx.cs page
conn = new SqlConnection(ConfigurationManager.AppSettings["test"]);
conn.Open();
SqlCommand cmd = new SqlCommand(“spregistration”, conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue(“@companyname”, txtcompanyname.Text);
cmd.Parameters.AddWithValue(“@title”, droptitle.Text);
cmd.Parameters.AddWithValue(“@name”, txtname.Text);
cmd.Parameters.AddWithValue(“@designation”, txtdesignation.Text);
cmd.ExecuteNonQuery();
cmd.Connection.Close();
Stored Procedure:
CREATE PROCEDURE spregistration
@companyname varchar (200),
@title varchar (200),
@name varchar (200),
@designation varchar (50)
AS
INSERT INTO [tbl_registration]
(companyname,title,[name],designation)
VALUES (@companyname,@title,@name,@designation)
RETURN
GO
Click Here!