# Re: 为何开启2000笔之资料需要20-30秒(ADO+SQL)

Posted by 大汉堡 on August 02, 1999 at 16:34:43:

In Reply to: 为何开启2000笔之资料需要20-30秒(ADO+SQL) posted by 等待救命之人 on August 02, 1999 at 15:21:04:

: 请问我用ADO开启SQL之资料档
: connstr = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=LONG3;Data Source=LONG-NT"
: conn.Open connstr
: rs1.CursorLocation = adUseClient
: rs1.Open "商品主档", conn, adOpenKeyset, adLockOptimistic
: Set DataGrid1.DataSource = rs1

: 资料大约2000笔为何需20-30秒
1.CursorLocation 设为adUseServer会较快
2.DataBase加上Index and open recordset 用
SQL ,记得SQL语法内要加Order By Field(index field)
3.DataGrid 加上 adUseClient 真的很慢,可考虑用Other Method

Follow Ups: