+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Initializing Designer with ODBC Connection


(Grant Passfield) #1

I am trying to initialize the designer view with an ODBC connection. Our database has many tables and often linked with foreign keys. The designer assignment throws and ODBCException when trying to retrieve the schema for the database:

var wNewListLabel = new combit.ListLabel22.ListLabel();
var wNewListLabelDesigner = new DesignerControl();

var conn = new OdbcConnection(usercredentials))
{
ConnectionTimeout = 800
};
conn.Open();
wNewListLabel.DataSource = conn;

wNewListLabelDesigner.ParentComponent = wNewListLabel ;

//Assigned the designer to the WindowsFormsHost
This Line of code throws the ODBC Exception and causes the application to crash
Host.Child.Controls.Add(wNewListLabelDesigner);

If I run SQL Profile during this command, I can see the SQL that List and Label is trying to execute and fails:

exec sp_executesql N’
SELECT *
FROM [LAB_PACKAGE]
WHERE [LAB_PACKAGE].[LABORATORY_ID]=@P1
‘,N’@P1 nvarchar(10)’,N’ICP61,OG62’

If I manually run this SQL I get the same error. The issue is, why is it trying to execute this SQL?
Lab_Package.Laboratory_ID is a numeric column but it is trying to convert a string value that is unrelated to the ID column.
Is there a way to fetch the schema without querying the tables like the Designer is trying to do?

Please let me know if you need more details.