locked
Confusion of data in datasets RRS feed

  • Question

  • User-812169386 posted

    Hello. I made a website where users log in to the system and add and update materials. I have a problem like this. When the system is very busy, when the user logs in with his name, he sees the data of another user. Although the session information is correct, incorrect data comes from the dataset. I will be grateful if you could help me.

    Example image; https://hizliresim.com/7ym8oJ

    Monday, July 6, 2020 7:26 AM

All replies

  • User753101303 posted

    Hi,

    Most often it happens when using static data: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-classes-and-static-class-members

    Unlike a Windows app, this is a single app used by multiple users and so static data are shared accross all users. Check or show your dataset declaration.

    Monday, July 6, 2020 8:10 AM
  • User288213138 posted

    Hi muhammedfatih,

    I have a problem like this. When the system is very busy, when the user logs in with his name, he sees the data of another user

    According to your description, I can not reproduce your problem.

    Can you show me how you query the data in the datasets? and you can try to clear your session and then re-run your project.

    Best regards,

    Sam

    Tuesday, July 7, 2020 2:35 AM
  • User-812169386 posted

    //this way I get the session information.

    Session.Add("LoginName", TxtKullaniciAdi.Text);

    //I list data from datasets on pages like this.

    public partial class OperatorStokBilgisi : System.Web.UI.Page     {         KoruCRMEntityDataContext DBBaglanti = new KoruCRMEntityDataContext();         protected void Page_Load(object sender, EventArgs e)         {             try             {                 if (Page.IsPostBack == false)                 {                     //UniteID = Convert.ToInt32(Request.QueryString["ID"].ToString());                     User uniteBul = (from c in DBBaglanti.Users                                      where c.KullaniciAdi == Session["LoginName"].ToString()                                      select c).First();                     Uniteler UniteBilgileriGetir = (from c in DBBaglanti.Unitelers                                                     where c.ID == uniteBul.UniteID                                                     select c).First();                     Label1.Text = "Stok Bilgisi: " + UniteBilgileriGetir.UniteAdi;                     //DataSetTableAdapters.MalzemeGetirTableAdapter dt = new DataSetTableAdapters.MalzemeGetirTableAdapter();                     //Repeater1.DataSource = dt.GetData(UniteBilgileriGetir.UniteAdi);                     //Repeater1.DataBind();                     //dataseti değiştirdik                     DataSetOperatorTableAdapters.UniteMalzemeListesiTableAdapter dt = new DataSetOperatorTableAdapters.UniteMalzemeListesiTableAdapter();                     Repeater1.DataSource = dt.GetData(UniteBilgileriGetir.UniteAdi);                     Repeater1.DataBind();                 }             }             catch (Exception)             {             }                      }     }
    Tuesday, July 7, 2020 8:38 AM
  • User288213138 posted

    Hi muhammedfatih,

    Can you explain the place circled in red in your image?

    Label1.Text = "Stok Bilgisi: " + UniteBilgileriGetir.UniteAdi;

    The red part below displays the Label1.Text? and what version of the database are you using?

    Best regards,

    Sam

    Wednesday, July 8, 2020 6:20 AM
  • User-812169386 posted
    The red information in the picture is the session information at the top. The red ring on the bottom is the part that should be the same as the top. I use sql server 2017 as database.
    Wednesday, July 8, 2020 7:18 AM
  • User-812169386 posted
    My problem is that when too many users enter the system, the data is confused. It is not normally a very common situation. So if we look at these things, shouldn't there be a constant problem?
    Wednesday, July 8, 2020 7:22 AM
  • User753101303 posted

    Hi,

    For now it seems fine. Maybe in your context. You have generated those table adapters or you wrote them ? What if you search for "static" in your code to spot static data that shouldn't be shared accross all users.

    Or maybe a logic issue. If I expect a single row, I prefer to use Single than First (so that it throws if not finding exactly one row rather than maybe not selecting always the same first row).

    Wednesday, July 8, 2020 7:42 AM