Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6468043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:51:11+00:00 2026-05-25T05:51:11+00:00

I was trying to add new row to my database table and it seams

  • 0

I was trying to add new row to my database table and it seams that everything is going well in the application WPF and when i close the application the database has not changed(new record was not added in the database ) I tried to use dataadapters so here is my class that i use and the code behing

  DD.cs
   namespace WpfApplication2
  {
   class DD
  {

    private Database1DataSetTableAdapters.Table1TableAdapter _cpuAdapter = null;

    protected Database1DataSetTableAdapters.Table1TableAdapter Adapter
    {
        get
        {
            if (_cpuAdapter == null)
                _cpuAdapter = new Database1DataSetTableAdapters.Table1TableAdapter();

            return _cpuAdapter;
        }

    }





      [System.ComponentModel.DataObjectMethodAttribute
(System.ComponentModel.DataObjectMethodType.Insert, true)]
    public bool AddCPU(string Naslov, string Avtor, string Lokacija, int Broj, string 

Zabeleska, string Izdava)
{

        Database1DataSet.Table1DataTable cpus = new Database1DataSet.Table1DataTable();
        Database1DataSet.Table1Row cpu = cpus.NewTable1Row();

        cpu.Naslov = Naslov;
        if (Naslov == null) cpu.SetNaslovNull();
        else cpu.Naslov = Naslov;
        if (Avtor == null) cpu.SetAvtorNull();
        else cpu.Avtor = Avtor;
        if (Zabeleska == null) cpu.SetZabeleskaNull();
        else cpu.Zabeleska = Zabeleska;
        if (Izdava == null) cpu.SetIzdavaNull();
        else cpu.Izdava = Izdava;
        if (Broj == null) cpu.SetBrojNull();
        else cpu.Broj = Broj;
        if (Lokacija == null) cpu.SetLokacijaNull();
        else cpu.Lokacija = Lokacija;


        cpus.AddTable1Row(cpu);
        int rowsAffected = Adapter.Update(cpus);

        // Return true if precisely one row was inserted, otherwise false
        return rowsAffected == 1;
    }

 HERE IS THE CODE BEHIND

 it's an event on button click
   string n, a, z,t,l;
        int b;
        l = txtLokacija.Text;
        t = txtBroj.Text;
        b = Convert.ToInt32(t);
        n = txtNaslov.Text;
        a = txtAvtor.Text;
        z = txtZabeleska.Text;
        t = "NONE";
        txtZabeleska.Clear();
        DD obj1=new DD();
        obj1.AddCPU(n,a,l,b,z,t);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T05:51:11+00:00Added an answer on May 25, 2026 at 5:51 am

    I found IT….when i finished the application and published then it seemed everything ok the database was working properly..i;ve restarted the PC and the newly added record

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a row into a mysql database table using visual studio
I am trying to get a new dynamically created row to add to a
Im trying to add an element to a database and then return a new
I'm trying to develop a JS function that creates a new row each time
I'm trying to add content from my database to a table I created with
I'm trying to figure out where DataRowCollection.Add(DataRow row) inserts the new row into its
I am currently trying to simply insert a new row into my SQLite3 database
I'm trying to add new output column using synchronous custom data flow component(below is
I'm trying to add a new node to an jQuery SimpleTree , but all
I am trying to add a new menu item to Eclipse's popupmenus. It really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.