Cannon insert large values in Access memo field

  • Thread starter Thread starter Tosch
  • Start date Start date
T

Tosch

I have to transfer data from a sql table into an access table. The
column in access is defined as memo.
Whenever I add a row where the size of the memo field is larger than
about 8000 bytes I get an error: 'The field is too small for the
amount of data. try inserting less data'.

What is the problem here?
In Access the memo field can hold more than 8k of data afaik.

Tosch
 
In my Access DB the fields are declared as:
Gruppe Text(41)
Name Text(41)
Inhalt Memo

Here's the code to insert the rows. dsEBib is a DataSet where the data are read into from a SQL Server.

cmdABib = New OleDb.OleDbCommand()
cmdABib.CommandText = "INSERT INTO Bibliothek VALUES (@Gruppe, @Name, @Inhalt) "
cmdABib.Parameters.Add(New OleDb.OleDbParameter("@Gruppe", OleDb.OleDbType.VarChar, 41))
cmdABib.Parameters.Add(New OleDb.OleDbParameter("@Name", OleDb.OleDbType.VarChar, 41))
cmdABib.Parameters.Add(New OleDb.OleDbParameter("@Inhalt", OleDb.OleDbType.LongVarBinary))
cmdABib.Connection = connBib

For Each drE In dsEBib.Tables(0).Rows
cmdABib.Parameters("@Gruppe").Value = drE("GrpNeu")
cmdABib.Parameters("@Name").Value = drE("Name")
cmdABib.Parameters("@Inhalt").Value = drE("Inhalt")
Try
cmdABib.ExecuteNonQuery()
Catch exins As Exception
Debug.WriteLine("Error: " + exins.Message)
End Try
Next
 
Back
Top