Updating mdb file
-
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
-
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
Or try making the field bigger.
-
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
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.
-
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.