Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

application freezing when reading an ODBC large text field

$
0
0

I have a Filemaker table with some long strings of characters probably 4000 characters long or so, and it seemed to work when testing with a simple test application, but now that I'm trying to apply it to my active project which this piece is critical, it seems when I get to the following line of code in debug mode it seems to freeze until I quit debugging:

retval = reader.GetChars(reader.GetOrdinal("Transmittal"), startIndex, outChar, 0, bufferSize);

So I'm at a loss as to how I can get by without even waiting or whether my memory is somehow clogged which I'm not sure how to clear up if that's the case.  Here's the code that I've been trying diligently to get working as I had expressed in a previous question:

            string StrTransmittal = "";         // xml Transmittal section 
            string StrCitationViolation = "";   // xml CitationViolation section
            string StrAttachment = "";          // xml Attachment section

            // Size of the memo buffer.
            int bufferSize = 1024;
            // The memo char[] buffer to be filled by GetChars.
            char[] outChar = new char[bufferSize];
            // The chars returned from GetChars.
            long retval;
            // The starting position in the memo output.
            long startIndex = 0;

            OdbcConnection myconE = new OdbcConnection(connString_ALink);
            myconE.Open();
            string cmdstr = @"SELECT * FROM ECitationXML";
            OdbcCommand cmd = new OdbcCommand(cmdstr);
            cmd.Connection = myconE;
            OdbcDataReader reader;
            reader = cmd.ExecuteReader();
            try
            {
                string temp = "";
                reader.Read();
                startIndex = 0;
                retval = reader.GetChars(reader.GetOrdinal("Transmittal"), startIndex, outChar, 0, bufferSize);
                while (retval == bufferSize)
                {
                    temp = new string(outChar);
                    StrTransmittal += temp;
                    startIndex += bufferSize;
                    retval = reader.GetChars(1, startIndex, outChar, 0, bufferSize);
                }
                temp = new string(outChar);
                StrTransmittal += temp.Substring(0, (int)retval);

                // CitationViolation
                startIndex = 0;
                retval = reader.GetChars(reader.GetOrdinal("CitationViolation"), startIndex, outChar, 0, bufferSize);
                while (retval == bufferSize)
                {
                    temp = new string(outChar);
                    StrCitationViolation += temp;
                    startIndex += bufferSize;
                    retval = reader.GetChars(1, startIndex, outChar, 0, bufferSize);
                }
                temp = new string(outChar);
                StrCitationViolation += temp.Substring(0, (int)retval);

                // Attachment
                startIndex = 0;
                retval = reader.GetChars(reader.GetOrdinal("Attachment"), startIndex, outChar, 0, bufferSize);
                while (retval == bufferSize)
                {
                    temp = new string(outChar);
                    StrAttachment += temp;
                    startIndex += bufferSize;
                    retval = reader.GetChars(1, startIndex, outChar, 0, bufferSize);
                }
                temp = new string(outChar);
                StrAttachment += temp.Substring(0, (int)retval);
            }
            catch (Exception ex)


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>