Hi,
I am trying to insert data into my database throgh Entity framwork my code is below

private POSDatabaseEntities1 posde = new POSDatabaseEntities1();

    private void btnSave_Click(object sender, EventArgs e)
        {
            Tbl_Users Users = new Tbl_Users();
            Users.FirstName = txtFName.Text;
            Users.LastName = txtLName.Text;
            Users.CNICNumber = txtCNIC.Text;

            RBSDE.AddToTbl_Users(Users);
            RBSDE.SaveChanges();

            MessageBox.Show("Record has successuffly beem Saved");
        }

Although i am geting the messagebos but when i close my application and open table data the entry is not inserted i am stuck with this why it is not giving errors

Are you running this in debug mode using a file based DB system? If so, Visual Studio makes a copy of the database so you don't mess up the original while debugging.

yes indeed..
i am not fimilar with these modes much but i have tried after changing the mode that is from debug to release mode(which was only other option) but still it is not saving data into db
what could be the remedy for this
regards

Also you're declaring an object called posde, but you're using an object called RBSDE. Is this on purpose?

i did a mistake while copying here i have used the same object bt unable to.
i cant figure it out that y i am not havng any error if it is not inserted in db

Your problem might be in the type of object that Tbl_Users is. If it's a custom class then you might have to but the data into something like a datarow that can be inserted into a datatable. The problem could also be in RBSDE. what kind of object is it?

basicaly RBSDB is the database entity in my previous code as it wsnt wroking i made some mistake then again i made the whole project from the scrape with the new database entity name posde
as i said here i used the entity model Tbl_Users is made by the entity model but m stuck now wroking with sql quries

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.