You must Sign In to post a response.
  • Category: ASP.NET

    Genterate different number using LAN in

    i need to genterate the different number (sales number) 5 systems 1 is server and 4 are client . in that 4 system sales window is in open .so my problem is same sales number is displyed in that 4 clients i need to differencite it .
    4 system are in ground floor 1 floor 2 floor 3 floor
  • #762448

    When your application open in server you can follow this steps

    1. Application Textbox click event stored to the Sales number in your db from your server machine.

    2. then remaining in your 4 client machine check in your Keypress event go to db find previous number get that value plus increment them. you can do same process remaining machine .

    3. if you need different numbers generate every machine means you can follow this

    4. Store the keypress event save the sales number in server then remaining 4 client pc key press event means Which is the first request go to server you need store that number to server so remaining machine taking the previous number from the server .

    My solution is not fixed in your issue means share your code.

    Name : Dotnet Developer-2015
    Email Id

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762457
    Hello Selvi,

    You can use SQL Transaction to create lock while generating new numbers.

    Use IsolationLevel.Serializable in sql transactions.

    Sample code :

    SqlCommand mycmd = con.CreateCommand();
    SqlTransaction dBupdate = default(SqlTransaction);
    dBupdate = con.BeginTransaction(IsolationLevel.Serializable);

    mycmd.Connection = con;
    mycmd.Transaction = dBupdate;

    mycmd = new SqlCommand("Select ID FROM OrderMaster", con);
    dr = mycmd.ExecuteReader();
    if (dr.HasRows) {
    orderid = Convert.ToInt32(dr(0).ToString()) + 1;
    TextBoxOrderID.Text = "ORD00" + orderid.ToString();
    if ((orderid > 9)) {
    TextBoxOrderID.Text = "ORD0" + orderid.ToString();
    } else {
    TextBoxOrderID.Text = "ORD001";
    mycmd.CommandText = "Insert into OrderMaster(Order_ID, Order_Date) Values('" + TextBoxOrderID.Text + "', '" + OrderDate.Text + "')";
    catch(Exception ex)
    Go through the below link of MSDN Library for reference on Isolation Level :

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

Sign In to post your comments