The following vbscript can run above SQL.create table ANFCKLST(ZONENO varchar(10),AMOUNT int);
insert into ANFCKLST(ZONENO,AMOUNT) values('a',10000);
insert into ANFCKLST(ZONENO,AMOUNT) values('b',2000000);
insert into ANFCKLST(ZONENO) values('c');Dim objConnection
Dim objRecordset
Set objConnection = CreateObject("ADODB.Connection")
With objConnection
.ConnectionString = "Provider=MSDAORA.1; Data Source=orcl; User ID=system; Password=oracle"
'''''''''The following connection string does not work''''''''''''
'''.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=orcl;User Id=system;Password=oracle;"
.CursorLocation = 3 'adUseClient
.Open
End With
set objRecordset=CreateObject("ADODB.recordset")
objRecordset.Open "Select ZONENO,(case when AMOUNT <1000000 then 500 when AMOUNT <10000000 and AMOUNT >1000000 then 1000 when AMOUNT <50000000 and AMOUNT >10000000 then 1500 when AMOUNT <100000000 and AMOUNT >50000000 then 2000 else AMOUNT * 0.002 end ) as fee From ANFCKLST", objConnection
record_count = 0
Do While Not objRecordset.EOF
objRecordset.MoveNext
record_count = record_count +1
Loop
msgbox "record count:" & CStr(record_count)
Set objRecordset = Nothing
Set objConnection = Nothing
insert into ANFCKLST(ZONENO,AMOUNT) values('a',10000);
insert into ANFCKLST(ZONENO,AMOUNT) values('b',2000000);
insert into ANFCKLST(ZONENO) values('c');Dim objConnection
Dim objRecordset
Set objConnection = CreateObject("ADODB.Connection")
With objConnection
.ConnectionString = "Provider=MSDAORA.1; Data Source=orcl; User ID=system; Password=oracle"
'''''''''The following connection string does not work''''''''''''
'''.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=orcl;User Id=system;Password=oracle;"
.CursorLocation = 3 'adUseClient
.Open
End With
set objRecordset=CreateObject("ADODB.recordset")
objRecordset.Open "Select ZONENO,(case when AMOUNT <1000000 then 500 when AMOUNT <10000000 and AMOUNT >1000000 then 1000 when AMOUNT <50000000 and AMOUNT >10000000 then 1500 when AMOUNT <100000000 and AMOUNT >50000000 then 2000 else AMOUNT * 0.002 end ) as fee From ANFCKLST", objConnection
record_count = 0
Do While Not objRecordset.EOF
objRecordset.MoveNext
record_count = record_count +1
Loop
msgbox "record count:" & CStr(record_count)
Set objRecordset = Nothing
Set objConnection = Nothing
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货