VB6 .NET Interop - Performance issue

不打扰是莪最后的温柔 提交于 2020-01-06 02:33:16

问题


I'm trying to use a VB6 app consumed in a C# app. The VB6 App is a Winform app. To do this, I have modified the VB6 App (EXE) to a DLL. Then I've referenced it in my C# app. In my VB App, I've add a new Class with some methods just to open VB forms.

Everything works fine... except that if the form has many controls (30), the window is extremely slow to open (> 4s whereas < 1s in VB)

1/ Is this method good ?

2/ How to resolve this ?

Regards,

Florian

EDIT : I know where is the problem but I don't know how to resolve it. The method which is very slow to execute contains a dozen of sql string concatened by a ";" and the method ex : sqlString = "SELECT * FROM CUSTOMERS;SELECT * FROM PUBLISHERS..." OpenResultSet(strSelect) is called... a combobox is filled for each sql string


回答1:


From what you have written I would look at exactly how many rows / columns your 'SELECT * FROM XXXX' queries are returning.

SELECT * is generally considered bad practise as it can have massive performance implications (and will slow down for every column added to the table in the future, even if you don't need any data in that column) and if you have no WHERE clause your query will get slower every day that data is added to your table.



来源:https://stackoverflow.com/questions/3802394/vb6-net-interop-performance-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!