Hi,
I already asked this question recently on stackoverflow (http://stackoverflow.com/questions/14012537/odbcdataadapter-fillschema-calculates-wrong-maxlength-value-for-columns) but without much success, and think it might possibly be a (known?) problem with the MaxDB ODBC driver.
I want to access my MaxDB using ODBC using the 64 bit unicode SAP MaxDB driver (version 7.08.02.28, SDBODBCW.DLL). While accessing data seems to work fine (I can perform all CRUD operations), I do have a problem when I want to create an XSD schema file for a database table using .Net DataSets.
The coding looks as follows:
DataSet ds =newDataSet();
Connection con =newOdbcConnection(connectionString);
string tablename ="sometable";
...
OdbcDataAdapter adapter =newOdbcDataAdapter("select * from "+ tablename, con);
adapter.FillSchema(ds,SchemaType.Source);
adapter.Fill(ds,tablename);
ds.WriteXmlSchema(tablename+".xsd");
and compiles and runs without any complaint, but in the resulting xsd file the maxLength values for the items are about half of the actual size of the corresponding columns, that is, if I have a UNICODE char(15) field in the database, the corresponding tag in the xsd looks as follows:
<xs:maxLength value="7" />
The wrong value is already present in the DataSet. Is this possibly a known issue? Since I'm new to ODBC and .Net DataSets I'm having difficulties to figure out where to start an analysis of this problem, any hints for this would also be higly appreciated.
Thanks in advance and kind regards (and merry XMas ;-)
Thomas