Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Updating mdb file

Updating mdb file

Scheduled Pinned Locked Moved C#
cssannouncement
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Admin887
    wrote on last edited by
    #1

    i am trying to update a mdb file. i added a new rows to the dataset and now i am trying to update a empty mdb file to the content of the dataset. i did something but i received an exception: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. my code is:

    string connectionString = "provider=Microsoft.JET.OLEDB.4.0; " + "data source =" + Dir;
    string commandString = "Select id,name from table";

    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(commandString, connectionString);
    My_DataSet = new DataSet();
    OleDbCommandBuilder cb = new OleDbCommandBuilder(dataAdapter);
    dataAdapter.Fill(My_DataSet, "Events");

    //here i added some new rows to the dataset

    dataAdapter.Update(My_DataSet, "Events"); // The exception is here

    P M 2 Replies Last reply
    0
    • A Admin887

      i am trying to update a mdb file. i added a new rows to the dataset and now i am trying to update a empty mdb file to the content of the dataset. i did something but i received an exception: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. my code is:

      string connectionString = "provider=Microsoft.JET.OLEDB.4.0; " + "data source =" + Dir;
      string commandString = "Select id,name from table";

      OleDbDataAdapter dataAdapter = new OleDbDataAdapter(commandString, connectionString);
      My_DataSet = new DataSet();
      OleDbCommandBuilder cb = new OleDbCommandBuilder(dataAdapter);
      dataAdapter.Fill(My_DataSet, "Events");

      //here i added some new rows to the dataset

      dataAdapter.Update(My_DataSet, "Events"); // The exception is here

      P Online
      P Online
      PIEBALDconsult
      wrote on last edited by
      #2

      Or try making the field bigger.

      1 Reply Last reply
      0
      • A Admin887

        i am trying to update a mdb file. i added a new rows to the dataset and now i am trying to update a empty mdb file to the content of the dataset. i did something but i received an exception: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. my code is:

        string connectionString = "provider=Microsoft.JET.OLEDB.4.0; " + "data source =" + Dir;
        string commandString = "Select id,name from table";

        OleDbDataAdapter dataAdapter = new OleDbDataAdapter(commandString, connectionString);
        My_DataSet = new DataSet();
        OleDbCommandBuilder cb = new OleDbCommandBuilder(dataAdapter);
        dataAdapter.Fill(My_DataSet, "Events");

        //here i added some new rows to the dataset

        dataAdapter.Update(My_DataSet, "Events"); // The exception is here

        M Offline
        M Offline
        Manas Bhardwaj
        wrote on last edited by
        #3

        You can pretty much narrow this down to one of the Text columns. Compare the size of the columns with what you are trying to enter into them. If you didn't set a specific size for the column when you made it, it will default to 50 characters. The other thing you might want to double check is the order in which you have added the parameters. It must exactly follow the order in which they appear in the SQL. otherwise the value of one might be trying to get inserted into the wrong column, which would cause this error.

        Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        A 1 Reply Last reply
        0
        • M Manas Bhardwaj

          You can pretty much narrow this down to one of the Text columns. Compare the size of the columns with what you are trying to enter into them. If you didn't set a specific size for the column when you made it, it will default to 50 characters. The other thing you might want to double check is the order in which you have added the parameters. It must exactly follow the order in which they appear in the SQL. otherwise the value of one might be trying to get inserted into the wrong column, which would cause this error.

          Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          A Offline
          A Offline
          Admin887
          wrote on last edited by
          #4

          Thank you! that was perfect :-D

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups