I am trying to populate a drop down list with a database query in an ASP.NET project. My problem is that the result values from the query are being truncated at 15 characters, and I don't know why this would be.
I am using System.Data.ODBC.
I am creating my database connection using OdbcConnection("SYSTEM_DSN");
OdbcConnection cxconn = new OdbcConnection("DSN=SYSTEMDSN");
My query is in a string:
//build the select statement to get items to populate session drop-down
string ProgramQuery = "SELECT major_table.txt_adm from major_table where major_table.dept = 'EXCL' ";
ProgramQuery += "and major_table.web_display = 'Y' and major_table.inactive_date is NULL;";
And this is how I execute the query and populate my drop-down:
OdbcCommand cxcommand = cxconn.CreateCommand();
cxcommand.CommandText = ProgramQuery;
OdbcDataReader dbreader = cxcommand.ExecuteReader();
// rest of the code to process the result set
int fCount = dbreader.FieldCount;
for (int i = 0; i < fCount; i++)
Response.Write(" " + dbreader.GetValue(i));
//close the dbreader
//bind the data on ddlSess and set the selected value by default to be the first one.
ddlProg.SelectedIndex = 0;
The resulting values in the drop down list are truncated at 15 characters. So, "Business Administration" becomes "Business Admini". I am unable to figure out why this is the case. My database is an INFORMIX database and I have the system DSN created using the INFORMIX 3.80 32 BIT driver.
Any help would be really appreciated. Thanks for looking into this.