Re:从SQL DB获取信息 [英] Re: Getting info from SQL DB

查看:79
本文介绍了Re:从SQL DB获取信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bill Schanks < ws ****** @ gmail.comschrieb


我有这个代码,它将采用listview中的内容并获取

更多信息在大量的listview记录中,这将产生一个问题(如果我有30,000个Listview entires,请说)。


建议的替代方案是什么?让它将listview

项加载到表中,然后将我的查询加入到该表中,输入

检查,如果有> 1000 listview entires don'不允许sql

查找?



尝试执行


lvMembers.beginupdate


填写前和


lvMembers.endupdate


之后。现在好了吗?

试试这个版本:(尝试)


Dim Items As String()

ReDim项目(reader.FieldCount - 1)


Do read reader.Read

Items(0)= CStr(reader(0))


For i = 1 to reader.FieldCount - 1

如果reader.IsDBNull(i)那么

Items(i)="" ; ''或String.Empty

否则

项目(i)= reader.GetString(i)

结束如果

Next i


itmListItem = New ListViewItem(Items)

lvmembers.Items.Add(itmListItem)

icount = icount + 1


循环


Armin

解决方案

错误即将发生,因为sSQL太大了,当在in子句中有30000个条目时,我得到了SQL Excecution的

错误

的sql命令。


4月25日下午12:50,Armin Zingler < az.nos ... @ freenet.dewrote:


" Bill Schanks" < wscha ... @ gmail.comschrieb


我有这个代码,它将采用listview中的内容并获取

更多信息。在大量的listview记录中,这将产生一个问题(如果我有30,000个Listview entires,那就说)。


建议的替代方案是什么?让它将listview

项加载到表中,然后将我的查询加入到该表中,输入

检查,如果有> 1000 listview entires don'不允许sql

查找?



尝试执行


lvMembers.beginupdate


填写前和


lvMembers.endupdate


之后。现在好些了吗?


试试这个版本:(一次尝试)


Dim Items As String()


ReDim项目(reader.FieldCount - 1)


Do while reader.Read

Items(0)= CStr(reader(0))


For i = 1 to reader.FieldCount - 1

如果reader.IsDBNull(i)那么

项目(i) ="" ''或String.Empty

否则

项目(i)= reader.GetString(i)

结束如果

Next i


itmListItem = New ListViewItem(Items)

lvmembers.Items.Add(itmListItem)

icount = icount + 1


循环


Armin



" Bill Schanks" < ws ****** @ gmail.com在留言中写道

news:05 ************************ ********** @ 34g2000h sf.googlegroups.com ...


错误即将发生,因为sSQL太大了,我得到了在sql命令的in子句

中有30000个条目时,SQL Excecution上的
错误。


4月25日,12:50 pm,Armin Zingler < az.nos ... @ freenet.dewrote:


>" Bill Schanks" < wscha ... @ gmail.comschrieb


我有这个代码,它将采用listview中的内容并获取

更多信息。在大量的listview记录中,这将产生一个问题(如果我有30,000个Listview entires,那就说)。


建议的替代方案是什么?让它将listview

项加载到表中,然后将我的查询加入到该表中,输入

检查,如果有> 1000 listview entires don'不允许sql

查找?


尝试在填写之前执行

lvMembers.beginupdate



lvMembers.endupdate
试试这个版本:(尝试)

Dim Items As String()

ReDim Items(reader.FieldCount - 1 )

做读者阅读
项目(0)= CStr(读者(0))

对于i = 1到reader.FieldCount - 1
如果reader.IsDBNull(i)那么
Items(i)="" ''或String.Empty
其他
项目(i)= reader.GetString(i)
结束如果
接下来我

itmListItem =新ListViewItem (项目)
lvmembers.Items.Add(itmListItem)
icount = icount + 1

循环

Armin



您要做的是如果您使用ListView,请将其设为虚拟

列表视图。如果你需要,我有样品。可以很快填写并显示30K物品




LS


错误没有填写列表视图,它甚至没有达到

点。 SQL命令是问题所在。这是我得到的错误:


system.data.sqlclient.sqlexception:内部查询处理器错误:

查询处理器在查询期间耗尽了堆栈空间优化


这是由于IN Clause有30000项。我的问题应该是

我有程序将列表视图项加载到表中然后加入

到该表我的查询,或者只是不允许命令如果IN

条款将超过x个项目。


4月25日下午1点04分,Lloyd Sheen < a ... @ b.cwrote:


" Bill Schanks" < wscha ... @ gmail.com写信息


新闻:05 *********************** *********** @ 34g2000h sf.googlegroups.com ...


错误即将发生,因为sSQL太大了,我是当sql命令的in子句

中有30000个条目时,在SQL Excecution上获得

错误。


4月25日下午12:50,Armin Zingler < az.nos ... @ freenet.dewrote:


" Bill Schanks" < wscha ... @ gmail.comschrieb


我有这个代码,需要什么是列表视图,去获取

更多信息。在大量的listview记录中,这将产生一个问题(如果我有30,000个Listview entires,那就说)。


建议的替代方案是什么?让它将listview

项加载到表中,然后将我的查询加入到该表中,输入

检查,如果有> 1000 listview entires don'不允许sql

查找?


尝试执行


lvMembers.beginupdate

$ b填充前$ b和


lvMembers.endupdate


之后。现在好点了?


试试这个版本:(一次尝试)


Dim Items As String()

< blockquote class =post_quotes>
ReDim Items(reader.FieldCount - 1)


Do While reader.Read

Items(0)= CStr(reader(0))


For i = 1 to reader.FieldCount - 1

如果reader.IsDBNull(i)那么

Items(i)=" " ''或String.Empty

否则

项目(i)= reader.GetString(i)

结束如果

Next i


itmListItem = New ListViewItem(Items)

lvmembers.Items.Add(itmListItem)

icount = icount + 1


循环


Armin



你想要做的是如果你使用ListView,使它成为虚拟的
列表视图。如果你需要,我有样品。可以很快填写和显示30K物品




LS


"Bill Schanks" <ws******@gmail.comschrieb

I have this code, that will take what is in a listview and go get
more info. Howerver on a large number of listview records this will
produce a problem (Say if I had 30,000 Listview entires).

What would be the recommended alternative? Have it load the listview
items to a table and then have my query join to that table, Put in a
check and if there are >1000 listview entires don''t allow the sql
lookup?

Try to execute

lvMembers.beginupdate

before filling and

lvMembers.endupdate

afterwards. Better now?
And try this version: (an attempt)

Dim Items As String()

ReDim Items(reader.FieldCount - 1)

Do While reader.Read
Items(0) = CStr(reader(0))

For i = 1 To reader.FieldCount - 1
If reader.IsDBNull(i) Then
Items(i) = "" ''or String.Empty
Else
Items(i) = reader.GetString(i)
End If
Next i

itmListItem = New ListViewItem(Items)
lvmembers.Items.Add(itmListItem)
icount = icount + 1

Loop


Armin

解决方案

The error is coming because sSQL is too large, and I am getting the
error on SQL Excecution when there are 30000 entries in the in clause
of the sql command.

On Apr 25, 12:50 pm, "Armin Zingler" <az.nos...@freenet.dewrote:

"Bill Schanks" <wscha...@gmail.comschrieb

I have this code, that will take what is in a listview and go get
more info. Howerver on a large number of listview records this will
produce a problem (Say if I had 30,000 Listview entires).

What would be the recommended alternative? Have it load the listview
items to a table and then have my query join to that table, Put in a
check and if there are >1000 listview entires don''t allow the sql
lookup?


Try to execute

lvMembers.beginupdate

before filling and

lvMembers.endupdate

afterwards. Better now?

And try this version: (an attempt)

Dim Items As String()

ReDim Items(reader.FieldCount - 1)

Do While reader.Read
Items(0) = CStr(reader(0))

For i = 1 To reader.FieldCount - 1
If reader.IsDBNull(i) Then
Items(i) = "" ''or String.Empty
Else
Items(i) = reader.GetString(i)
End If
Next i

itmListItem = New ListViewItem(Items)
lvmembers.Items.Add(itmListItem)
icount = icount + 1

Loop

Armin



"Bill Schanks" <ws******@gmail.comwrote in message
news:05**********************************@34g2000h sf.googlegroups.com...

The error is coming because sSQL is too large, and I am getting the
error on SQL Excecution when there are 30000 entries in the in clause
of the sql command.

On Apr 25, 12:50 pm, "Armin Zingler" <az.nos...@freenet.dewrote:

>"Bill Schanks" <wscha...@gmail.comschrieb

I have this code, that will take what is in a listview and go get
more info. Howerver on a large number of listview records this will
produce a problem (Say if I had 30,000 Listview entires).

What would be the recommended alternative? Have it load the listview
items to a table and then have my query join to that table, Put in a
check and if there are >1000 listview entires don''t allow the sql
lookup?


Try to execute

lvMembers.beginupdate

before filling and

lvMembers.endupdate

afterwards. Better now?

And try this version: (an attempt)

Dim Items As String()

ReDim Items(reader.FieldCount - 1)

Do While reader.Read
Items(0) = CStr(reader(0))

For i = 1 To reader.FieldCount - 1
If reader.IsDBNull(i) Then
Items(i) = "" ''or String.Empty
Else
Items(i) = reader.GetString(i)
End If
Next i

itmListItem = New ListViewItem(Items)
lvmembers.Items.Add(itmListItem)
icount = icount + 1

Loop

Armin

What you want to do is if you are using ListView , make it a virtual
listview. I have samples if you need them. Can fill and display 30K items
very quickly.

LS


The error is not filling the listview, it doesn''t even get to that
point. The SQL Command is the problem. Here is the error I get:

system.data.sqlclient.sqlexception: Internal query processor error:
The query processor ran out of stack space during query optimization

This is due to the IN Clause have 30000 items. My question was should
I have the program load the list view items to a table and then join
to that table to my query, or just not allow the command if the IN
Clause would have more than x number of items.

On Apr 25, 1:04 pm, "Lloyd Sheen" <a...@b.cwrote:

"Bill Schanks" <wscha...@gmail.comwrote in message

news:05**********************************@34g2000h sf.googlegroups.com...

The error is coming because sSQL is too large, and I am getting the
error on SQL Excecution when there are 30000 entries in the in clause
of the sql command.

On Apr 25, 12:50 pm, "Armin Zingler" <az.nos...@freenet.dewrote:

"Bill Schanks" <wscha...@gmail.comschrieb

I have this code, that will take what is in a listview and go get
more info. Howerver on a large number of listview records this will
produce a problem (Say if I had 30,000 Listview entires).

What would be the recommended alternative? Have it load the listview
items to a table and then have my query join to that table, Put in a
check and if there are >1000 listview entires don''t allow the sql
lookup?

Try to execute

lvMembers.beginupdate

before filling and

lvMembers.endupdate

afterwards. Better now?

And try this version: (an attempt)

Dim Items As String()

ReDim Items(reader.FieldCount - 1)

Do While reader.Read
Items(0) = CStr(reader(0))

For i = 1 To reader.FieldCount - 1
If reader.IsDBNull(i) Then
Items(i) = "" ''or String.Empty
Else
Items(i) = reader.GetString(i)
End If
Next i

itmListItem = New ListViewItem(Items)
lvmembers.Items.Add(itmListItem)
icount = icount + 1

Loop

Armin


What you want to do is if you are using ListView , make it a virtual
listview. I have samples if you need them. Can fill and display 30K items
very quickly.

LS


这篇关于Re:从SQL DB获取信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆