//使用sql操作excel
//感谢carl
import com.excel; 

with { /*临时名字空间*/ }  begin
	var conn = ..com.excel.createSqlConnection("/my.xls","name1","name2")
	
	conn.Open();//打开数据库连接
	
	sql="insert into [Sheet1$](name1,name2)values('test1','test2')"//新增记录
	conn.execute(sql)
	
	sql="update [Sheet1$] set name1='快手' where name2='test2'"//修改记录
	conn.execute(sql)
	
	var rs = ..com.CreateObject("ADODB.RecordSet");
	sql="select * from [Sheet1$]"
	rs.Open(sql,conn,3,3);
	
	..io.open()
	while(not rs.eof){  //遍历
    	name1=rs("name1").Value;
    	name2=rs("name2").Value;
    	..io.print(name1,name2)
    	rs.movenext()
	}
	rs.close() 
	
	conn.close();//关闭数据库连接
end;


