I have been trying to fill my ultracombo box with data yet it takes a signifigant amount of time. However when I run the same stored procedure from withing sql server it takes relatively no time. The line of code that the program gets hung up on is:
我一直试图用数据填充我的ultracombo框,但需要相当长的时间。但是当我从使用sql server运行相同的存储过程时,它需要相对没有时间。程序挂起的代码行是:
SprocPatientsTableAdapter.Fill(Me.PatientsDataSet.sprocPatients, SelectedCustomerID)
By signifigant differnce of time I mean the difference of less than 5 seconds in sql server and more than three hours from within the program.
通过显着的时间差异,我的意思是在sql server中差异小于5秒,在程序中差异超过3小时。
5 个解决方案
#2
Try using the SQL Server Profiler to see what query your program is sending exactly to the database. You may see some other parameters being passed that are affecting the query and slowing it down dramatically.
尝试使用SQL Server Profiler查看程序正在向数据库发送的查询。您可能会看到一些其他参数正在传递,这些参数会影响查询并显着降低查询速度。
#3
How big is the result set it's returning? If you're sending 2.5GB over the wire, storing it in memory and spinning thru it to fill a collection, then yeah, of course it will be slow.
它返回的结果有多大?如果您通过电线发送2.5GB,将其存储在内存中并通过它旋转以填充集合,那么是的,当然它会很慢。
I guess the big question though, is: Are you really using all the data that's being handed back? Please tell me you're not grabbing the whole table, then filtering down to seven rows and showing ID and UserName!
我想最重要的问题是:你真的在使用所有正在传回的数据吗?请告诉我你没有抓住整个表格,然后过滤到七行并显示ID和UserName!
#4
For this particular result the database is sending 45,522 rows (~9.08mb)
对于这个特定的结果,数据库发送45,522行(~9.08mb)
As for the big question of whether or not we need all this data no we do not and I have argued that one until I went past blue into realms of extremely dark navy colors in my face, but somehow it’s “mission critical” that we get everything (not just what is needed at a given moment). The first clue that we are grabbing more than what we need is the fact we are using a multicolumn combo box in the first place (spent over 1k just to get that one control), sorry rant over.
至于我们是否需要所有这些数据这一大问题我们不会这样做,而且我一直认为这个问题直到我在蓝色中进入了我脸上极其深色海军色的领域,但不知怎的,我们得到的是“关键任务”一切(不仅仅是在特定时刻需要的东西)。我们获得的第一个线索比我们需要的更多的是我们首先使用多列组合框(花费超过1k只是为了得到那个控件),对不起咆哮。
The process is: the user enters their user name and id --> selects the hospital they want to view (and have access to) --> then all the patients that are in that hospital that use our service get loaded into the ultracombobox auto filled by account number (hidden). The ultracombobox (multicolumn) is bound to a few other text boxes (last name, first name, middle etc….) so the info can be edited.
过程是:用户输入他们的用户名和ID - >选择他们想要查看的医院(并且可以访问) - >然后在该医院中使用我们服务的所有患者都被加载到ultracombobox auto中由帐号填写(隐藏)。 ultracombobox(多列)绑定到一些其他文本框(姓氏,名字,中间等......),因此可以编辑信息。
#5
I am going to give credit RoadWarrior for directing me to my eventual resolution of disabling constraints on the dataset. The UltraCombo box that uses the dataset is only displaying data not manipulating it and with the constraints disabled my ultracombo box fills extraordinarily fast
我将赞美RoadWarrior,指导我最终解决对数据集禁用约束的问题。使用数据集的UltraCombo框只显示不操纵它的数据,并且禁用约束我的ultracombo框填充速度非常快
#1
See my (accepted) answer to a very similar question.
请参阅我的(接受的)一个非常相似的问题的答案。
#2
Try using the SQL Server Profiler to see what query your program is sending exactly to the database. You may see some other parameters being passed that are affecting the query and slowing it down dramatically.
尝试使用SQL Server Profiler查看程序正在向数据库发送的查询。您可能会看到一些其他参数正在传递,这些参数会影响查询并显着降低查询速度。
#3
How big is the result set it's returning? If you're sending 2.5GB over the wire, storing it in memory and spinning thru it to fill a collection, then yeah, of course it will be slow.
它返回的结果有多大?如果您通过电线发送2.5GB,将其存储在内存中并通过它旋转以填充集合,那么是的,当然它会很慢。
I guess the big question though, is: Are you really using all the data that's being handed back? Please tell me you're not grabbing the whole table, then filtering down to seven rows and showing ID and UserName!
我想最重要的问题是:你真的在使用所有正在传回的数据吗?请告诉我你没有抓住整个表格,然后过滤到七行并显示ID和UserName!
#4
For this particular result the database is sending 45,522 rows (~9.08mb)
对于这个特定的结果,数据库发送45,522行(~9.08mb)
As for the big question of whether or not we need all this data no we do not and I have argued that one until I went past blue into realms of extremely dark navy colors in my face, but somehow it’s “mission critical” that we get everything (not just what is needed at a given moment). The first clue that we are grabbing more than what we need is the fact we are using a multicolumn combo box in the first place (spent over 1k just to get that one control), sorry rant over.
至于我们是否需要所有这些数据这一大问题我们不会这样做,而且我一直认为这个问题直到我在蓝色中进入了我脸上极其深色海军色的领域,但不知怎的,我们得到的是“关键任务”一切(不仅仅是在特定时刻需要的东西)。我们获得的第一个线索比我们需要的更多的是我们首先使用多列组合框(花费超过1k只是为了得到那个控件),对不起咆哮。
The process is: the user enters their user name and id --> selects the hospital they want to view (and have access to) --> then all the patients that are in that hospital that use our service get loaded into the ultracombobox auto filled by account number (hidden). The ultracombobox (multicolumn) is bound to a few other text boxes (last name, first name, middle etc….) so the info can be edited.
过程是:用户输入他们的用户名和ID - >选择他们想要查看的医院(并且可以访问) - >然后在该医院中使用我们服务的所有患者都被加载到ultracombobox auto中由帐号填写(隐藏)。 ultracombobox(多列)绑定到一些其他文本框(姓氏,名字,中间等......),因此可以编辑信息。
#5
I am going to give credit RoadWarrior for directing me to my eventual resolution of disabling constraints on the dataset. The UltraCombo box that uses the dataset is only displaying data not manipulating it and with the constraints disabled my ultracombo box fills extraordinarily fast
我将赞美RoadWarrior,指导我最终解决对数据集禁用约束的问题。使用数据集的UltraCombo框只显示不操纵它的数据,并且禁用约束我的ultracombo框填充速度非常快