Inserting Data in C# asp.net by using stored proc sql-server .
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "xxxx_Ins_yyyy";
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@fname", fname.Text);
cmd.Parameters.AddWithValue("@lname", lname.Text);
cmd.Parameters.AddWithValue("@Address", Address.Text);
cmd.Parameters.AddWithValue("@zip", zip.Text);
cmd.Parameters.AddWithValue("@dphone", dphone.Text);
cmd.Parameters.AddWithValue("@ephone", fname.Text);
cmd.Parameters.AddWithValue("@emailid", fname.Text);
cmd.Parameters.AddWithValue("@UpDated", System.DateTime.Now);
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
private string ConnectionString
{
get
{
string connectionString = ConfigurationManager.ConnectionStrings"ConnectionString"].ConnectionString;
return connectionString;
}
}
www.visli.com
This is my technical area for troubleshooting and learning new programming skills and much more. Here, you will find answers on a wide range of technologies such as AI, Machine Learning, OpenAI, Databricks, ASP.NET, C#, Python, Microsoft Access, MySQL, Amazon Web Services, SQL Server, PL/SQL, JD Edwards, SAS, Salesforce, APIs, MVC, and many others. Please feel free to visit and join the discussion!
Showing posts with label Insert Data in C# asp.net 2.0 by using stored proc. sql server. Show all posts
Showing posts with label Insert Data in C# asp.net 2.0 by using stored proc. sql server. Show all posts
Wednesday, June 11, 2008
Subscribe to:
Posts (Atom)