using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Web.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataSet objds = new DataSet();
SqlConnection conn = new SqlConnection();
conn.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_details";
cmd.Parameters.AddWithValue("@select", "select");
conn.Open();
SqlDataAdapter objda = new SqlDataAdapter(cmd);
objda.Fill(objds);
conn.Close();
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
Boolean checkresult = new Boolean();
SqlConnection conn = new SqlConnection();
conn.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SP_details";
cmd.Parameters.AddWithValue("@select", "insert");
cmd.Parameters.AddWithValue("@fname", txtfname.Text);
cmd.Parameters.AddWithValue("@lname", txtlname.Text);
conn.Open();
checkresult = Convert.ToBoolean(cmd.ExecuteNonQuery());
conn.Close();
}
}
Connection String ----------
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=RAJESH-PC;Persist Security Info=True;Initial Catalog=test;User ID=sa;Password=xyz" providerName="System.Data.SqlClient"/>
</connectionStrings>
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Web.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataSet objds = new DataSet();
SqlConnection conn = new SqlConnection();
conn.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_details";
cmd.Parameters.AddWithValue("@select", "select");
conn.Open();
SqlDataAdapter objda = new SqlDataAdapter(cmd);
objda.Fill(objds);
conn.Close();
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
Boolean checkresult = new Boolean();
SqlConnection conn = new SqlConnection();
conn.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SP_details";
cmd.Parameters.AddWithValue("@select", "insert");
cmd.Parameters.AddWithValue("@fname", txtfname.Text);
cmd.Parameters.AddWithValue("@lname", txtlname.Text);
conn.Open();
checkresult = Convert.ToBoolean(cmd.ExecuteNonQuery());
conn.Close();
}
}
Connection String ----------
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=RAJESH-PC;Persist Security Info=True;Initial Catalog=test;User ID=sa;Password=xyz" providerName="System.Data.SqlClient"/>
</connectionStrings>