Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

parallel programming

$
0
0
I have created a web application for inserting and updating a set of record using C#.net.
the coding is as follows.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
 
public partial class insert : System.Web.UI.Page
{
      SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\PRAVINR\Documents\Visual Studio 2010\WebSites\strikers\App_Data\royal.mdf;Integrated Security=True;User Instance=True");
      protected void Page_Load(object sender, EventArgs e)
      {
            DataBind();
 
      }
      protected void Button1_Click(object sender, EventArgs e)
      {
            try
            {
                  con.Open();
                  SqlCommand cmd = new SqlCommand("insert rusty values(@CustID,@Name,@Address,@City,@Pin,@State,@Country,@ContactNO)", con);
                  cmd.Parameters.AddWithValue("@CustID", TextBox1.Text);
                  cmd.Parameters.AddWithValue("@Name", TextBox2.Text);
                  cmd.Parameters.AddWithValue("@Address", TextBox3.Text);
                  cmd.Parameters.AddWithValue("@City", TextBox4.Text);
                  cmd.Parameters.AddWithValue("@Pin", TextBox5.Text);
                  cmd.Parameters.AddWithValue("@State", TextBox6.Text);
                  cmd.Parameters.AddWithValue("@Country", TextBox7.Text);
                  cmd.Parameters.AddWithValue("@ContactNO", TextBox8.Text);
 
                  cmd.ExecuteNonQuery();
                  Label1.Text = "Inserted Completed..";
            }
            catch (Exception ex)
            {
                  Label1.Text = ex.ToString();
            }
            finally
            {
                  con.Close();
            }
 
      }
 
      protected void Button2_Click(object sender, EventArgs e)
      {
 
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            TextBox5.Text = "";
            TextBox6.Text = "";
            TextBox7.Text = "";
            TextBox8.Text = "";
           
      }
}
 
i need to change the coding to parallel processing so that the process of inserting is done parallel.
Can anyone help me solving this ?

Viewing all articles
Browse latest Browse all 3938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>