VB6 .NET 互操作 - 性能问题
我正在尝试使用 C# 应用程序中使用的 VB6 应用程序。 VB6应用程序是一个Winform应用程序。为此,我将 VB6 应用程序 (EXE) 修改为 DLL。然后我在我的 C# 应用程序中引用了它。在我的 VB 应用程序中,我添加了一个新类,其中包含一些方法来打开 VB 表单。
一切工作正常...除了如果窗体有很多控件 (30),则窗口打开速度非常慢(> 4 秒,而在 VB 中< 1 秒)
1/ 这种方法好吗?
2/ 如何解决这个问题?
问候,
弗洛里安
编辑:我知道问题出在哪里,但我不知道如何解决它。该方法执行速度非常慢,包含十几个由“;”连接的sql字符串。和方法 例如:sqlString =“从客户中选择*;从出版商中选择*...” 调用 OpenResultSet(strSelect)...为每个 sql 字符串填充一个组合框
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您所写的内容,我将查看您的“SELECT * FROM XXXX”查询到底返回了多少行/列。
SELECT * 通常被认为是不好的做法,因为它可能会产生巨大的性能影响(并且将来添加到表中的每一列都会减慢速度,即使您不需要该列中的任何数据)并且如果您没有 WHERE 子句当数据添加到表中时,您的查询每天都会变慢。
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.