Database Reference
In-Depth Information
// Open connection
conn.Open();
// Create data reader
dr = cmd.ExecuteReader();
}
public void RetrieveText_Load(object sender, EventArgs e)
{
try
{
while (GetRow() == true)
{
txtRetrieveText.AppendText ("----- end of file\n");
txtRetrieveText.AppendText(textFile);
txtRetrieveText.AppendText("\n============================\n");
}
}
catch (SqlException ex)
{
Console.WriteLine(ex.ToString());
}
finally
{
// Close the reader and the connection.
dr.Close();
conn.Close();
}
}
public bool GetRow()
{
long textSize;
int bufferSize = 100;
long charsRead;
textChars = new Char[bufferSize];
if (dr.Read())
{
// Get file name
textFile = dr.GetString(0);
txtRetrieveText.AppendText("------ start of file\n");
txtRetrieveText.AppendText(textFile);
txtRetrieveText.AppendText("\n");
textSize = dr.GetChars(1, 0, null, 0, 0);
txtRetrieveText.AppendText("--- size of text: " + textSize + " characters ---
");
txtRetrieveText.AppendText("\n--- first 100 characters in text -----\n");
charsRead = dr.GetChars(1, 0, textChars, 0, 100);
txtRetrieveText.AppendText(new String(textChars));
Search WWH ::




Custom Search