This is my code:

OleDbConnection connection = new OleDbConnection(
   "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\\Offline.accdb;Persist Security Info=False");
connection.Open();
OleDbCommand command = connection.CreateCommand();
command.CommandText = "SELECT DISTINCT B.* FROM BlankFormSubmissions B, Actions A WHERE A.FormName = 'FindingNemo' AND B.ProcessName = A.ProcessName AND B.ActionName = A.ActionName AND B.ID = 12 OR B.ID = 13 OR B.ID = 14 ORDER BY B.ID";
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
    string xml = (string)reader["XML"];
    // ... do something with xml
}

The column, "XML", is an Access Database table column, of type memo.

The value of xml always contains only the first characters of the XML. I'm guessing it's the first 256 characters. Obviously, I need all of the characters in the string.

Anyone know how to fix this?

Thanks :)

2

There are 2 answers

7
Johnny DropTables On BEST ANSWER

The problem could be the memo field itself;

Memo fields can't be used in Aggregate Arguments ( like Max, Var, Sum etc. ) If used in 'Group By' totals in a query only the first 255 characters are returned. 'Having' and 'Where' clauses in Group Aggregate functions also return only the first 255 chars However, using 'First' or 'Last' arguments return the full length of the string.

Is this the entire SQL statement?

2
safi On

this way;)

 OleDbCommand sqlcmdCommand1 = new OleDbCommand("select stmt", sqlconConnection);
        sqlcmdCommand1.CommandType = CommandType.Text;
        try
        {
            sqlconConnection.Open();
            OleDbDataReader sdaResult = sqlcmdCommand1.ExecuteReader();
            myclass a = new myclass();
            while (sdaResult.Read())
            {

               a.i = sdaResult.GetString(2);
               or 
               int i = sdaResult.GetString(2)); 
              // 2 is the index of your column, in general start from 0;'
            }

if this do not work , i mean if you the value of my_memo_value is null then: create a class in which you get and set value of string and int. and then use it here Like

Myclass {
Public int i{get;set}
}