none
The records of Access DB are trimmed!!

    Question

  • Hi,

    I developed a C# program that deals with an Access DB, it reads a text from .txt files and split it into records according to predefined separator. However I notified the records of the DB are not complete. They are trimmed before the next separator. I don't know where is the problem.

    Is there a limit to the no. of characters that can be saved in the record??

    Thanks.

    Best regards.

    Aya.


    Aya Zoghby

    Tuesday, October 09, 2012 1:28 PM

Answers

  • In the question presented here, I found that I may change the type WChar to be OleDbType.LongVarWChar.

    I tried it with size of 1024000 , but nothing changed.

    It still truncated at a small size of text!!!

    I need a help urgently please.

    Thanks.

    Aya.


    Aya Zoghby

    • Marked as answer by ZoghbyAya Thursday, October 11, 2012 6:32 PM
    Wednesday, October 10, 2012 1:21 PM
  • Have been solved when I :

    From the 'Design View' of the table in Access DB: changed the 'Text Format' of the field , which is predefined as a Memo, to be 'Rich Text' rather than 'Plain Text'.

    Thanks for all.


    Aya Zoghby

    • Marked as answer by ZoghbyAya Wednesday, October 10, 2012 1:42 PM
    • Unmarked as answer by ZoghbyAya Thursday, October 11, 2012 7:11 AM
    • Marked as answer by ZoghbyAya Thursday, October 11, 2012 6:33 PM
    Wednesday, October 10, 2012 1:42 PM

All replies

  • can you check the length of the fields of the database table? maybe you can debugg ans see the values, after reading from the file.

    regards

    joon

    Tuesday, October 09, 2012 1:39 PM
  • Thank you for the reply.
    Actually I could not understand what you meant by 'length of the fields of the database table'. However I checked the program and found that the splitting function is working good and get the full text. The problem is occurred in the insertion into the DB process, and I can't capture WHY.

    Regards,
    Aya. 

    Aya Zoghby

    Tuesday, October 09, 2012 7:28 PM
  • In the Access DB, the columns to which you are inserting data have defined lengths.  Perhaps one of the lengths of one of the columns in the database is smaller than the length of the data you are inserting, so the database is trimming the data before inserting it.

    Tuesday, October 09, 2012 10:24 PM
  • OK, I created the query using the Query Builder, and I found the following fragment of code

                this._commandCollection[5] = new System.Data.OleDb.OleDbCommand();
                this._commandCollection[5].Connection = this.Connection;
                this._commandCollection[5].CommandText = "INSERT INTO DocumentsTable\r\n               (Raw_Corpus, Cleaned_Document, Interme" +
                    "diate_Stemmed_Documents, Doc_Lable)\r\nVALUES (?, ?, ?, ?)";
                this._commandCollection[5].CommandType = System.Data.CommandType.Text;
                this._commandCollection[5].Parameters.Add(new System.Data.OleDb.OleDbParameter("Raw_Corpus", System.Data.OleDb.OleDbType.WChar, 1024, System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)), "Raw_Corpus", System.Data.DataRowVersion.Current, false, null));

    In the question presented here, I found that I may change the type WChar to be OleDbType.LongVarWChar. But what about the size which already defined to be 1024, so what it the maximum size that I may use?

    Thanks so much.


    Aya Zoghby


    • Edited by ZoghbyAya Wednesday, October 10, 2012 1:06 PM
    Wednesday, October 10, 2012 1:05 PM
  • In the question presented here, I found that I may change the type WChar to be OleDbType.LongVarWChar.

    I tried it with size of 1024000 , but nothing changed.

    It still truncated at a small size of text!!!

    I need a help urgently please.

    Thanks.

    Aya.


    Aya Zoghby

    • Marked as answer by ZoghbyAya Thursday, October 11, 2012 6:32 PM
    Wednesday, October 10, 2012 1:21 PM
  • Have been solved when I :

    From the 'Design View' of the table in Access DB: changed the 'Text Format' of the field , which is predefined as a Memo, to be 'Rich Text' rather than 'Plain Text'.

    Thanks for all.


    Aya Zoghby

    • Marked as answer by ZoghbyAya Wednesday, October 10, 2012 1:42 PM
    • Unmarked as answer by ZoghbyAya Thursday, October 11, 2012 7:11 AM
    • Marked as answer by ZoghbyAya Thursday, October 11, 2012 6:33 PM
    Wednesday, October 10, 2012 1:42 PM
  • Unfortunately, I have got another problem now.

    When I use the UPDATE query instead of INSERT, the problem appears again.

    I did all the changes that solved the problem of INSERT , but nothing solved. It still truncated the record !!


    Aya Zoghby

    Wednesday, October 10, 2012 6:42 PM
  • Try to insert and update the same data in this program .

    If this trimmed problem both appear ,the reason will mostly be the length .

    If this problem just occur in insert or update , I think it should the problem of code. And here ,

    you’d better check your insert/update code .Or , post here .

    Please come back  and tell us the test result .

    Thursday, October 11, 2012 8:59 AM
  • If this problem just occur in insert or update , I think it should the problem of code.

    You are right, and all now is working well.

    The problem in the UPDATE query is in my code, since I am using two projects each with a database , and I modified just one while the program was execute  the other.
    So now the problem is solved as the post wrote before.

    Also, see this link, it helped me.

    Thanks for all.


    Aya Zoghby

    Thursday, October 11, 2012 6:31 PM