急,请执教。如何把数据库中查寻的结果显示到spread中??
Global CONN As New ADODB.Connection
Global G_DBCONNECTFLAG As Boolean
Global SQLSTMT As New ADODB.Recordset
Global Sqlcommand As ADODB.CommandPublic Function GETCONN()
Set CONN = New ADODB.Connection
CONN.ConnectionString = "Provider=MSDAORA.1;Password=PROPLUS;User ID=PROPLUS;Data Source=ORCLE;Persist Security Info=True"
CONN.Open
End Function
然后怎么做??
Global CONN As New ADODB.Connection
Global G_DBCONNECTFLAG As Boolean
Global SQLSTMT As New ADODB.Recordset
Global Sqlcommand As ADODB.CommandPublic Function GETCONN()
Set CONN = New ADODB.Connection
CONN.ConnectionString = "Provider=MSDAORA.1;Password=PROPLUS;User ID=PROPLUS;Data Source=ORCLE;Persist Security Info=True"
CONN.Open
End Function
然后怎么做??
spread.datasource=Rs
Private Sub Form_Load()
Call GETCONN
Dim STRSQL As StringSQLSTRING = "SELECT * FROM PPSS_ES_PRODUCT"
Set SQLSTMT = New ADODB.Recordset
Set SQLSTMT = CONN.Execute(SQLSTRING)
ff.DataSource = SQLSTMTEnd Sub
其中ff是spread的对象名,但是运行后没反应啊,是不是还要绑定什么?
在线等,太极了,必须快点做完
dim j as integer
with ff--spread的对象名
.maxrows=0
.marcols=SQLSTMT.fields.count
do while not SQLSTMT.eof
.maxrows=.maxrows+1
.ros=.maxrows
for i=1 to .maxcols
.col=i
.text=SQLSTMT.fields(i-1)
next i
SQLSTMT.movenext
loop
SQLSTMT.close
end with