-
ODBC and large data
I'm having this problem with my ODBC database objects. I have a field in the database that stores 2000 characters. However, whenever I extract very long data from it using Microsoft.Data.Odbc objects, I get an incomplete data.
Example, say I have a record in the database wherein that field contains 500 characters. When I retrieve it, I only get the first 25 characters.
Any ideas? Is there a way I can configure my ODBC driver to handle larger data? Thanks in advance.
-
Anything under 4k is not an ODBC driver issue.
What database is it stored on and what is the code that does the extraction?
-
The database is Interbase. I think it's not a database problem because when I tried querying the data directly from Interbase, it returns the entire string.
Anyway, here's the code:
public DataSet GetRemarks(string sku, long entryDate)
{
connection.Open();
OdbcCommand cmd = new OdbcCommand();
cmd.Connection = connection;
cmd.CommandText = "SELECT * FROM " + TableName + " " +
"WHERE " + Fields.EntryDate + " = " + entryDate +
"AND " + Fields.SKU + " = '" + sku + "' "+
"ORDER BY " + Fields.EntryDate + ", " + Fields.LineNum;
OdbcDataAdapter da = new OdbcDataAdapter(cmd);
OdbcDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Console.WriteLine(dr.GetString(5));
}
return dr;
}
-
The database is Interbase. I think it's not a database problem because when I tried querying the data directly from Interbase, it returns the entire string.
Anyway, here's the code:
public DataSet GetRemarks(string sku, long entryDate)
{
connection.Open();
OdbcCommand cmd = new OdbcCommand();
cmd.Connection = connection;
cmd.CommandText = "SELECT * FROM " + TableName + " " +
"WHERE " + Fields.EntryDate + " = " + entryDate +
"AND " + Fields.SKU + " = '" + sku + "' "+
"ORDER BY " + Fields.EntryDate + ", " + Fields.LineNum;
OdbcDataAdapter da = new OdbcDataAdapter(cmd);
OdbcDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Console.WriteLine(dr.GetString(5));
}
return dr;
}
-
Place a break point on your console.writeline and when it breaks there, add a watch to your dr object.
Does the watch show the full text within the object?
-
yes. i already tried that. it does not show the full text. that's the reason why i thought it's related with the odbc driver. because immediately after retrieving the records from the database using odbc objects, the large strings surprisingly become shortened.