1.asp 檔案:
<%
if request("act") = "" then
else
dim rs,sql,filename,fs,myfile,x,link
set fs = server.createobject("scripting.filesystemobject")
'--假設你想讓生成的excel檔案做如下的存放
filename = "c:online.xls"
'--如果原來的excel檔案存在的話刪除它
if fs.fileexists(filename) then
fs.deletefile(filename)
end if
'--建立excel檔案
set myfile = fs.createtextfile(filename,true)
set rs = server.createobject("adodb.recordset")
'--從資料庫中把你想放到excel中的資料查出來
sql = "select population,hourpos,datepos from populationperhour order by datepos,hourpos asc"
rs.open sql,conn
if rs.eof and rs.bof then
else
dim strline,responsestr
strline=""
for each x in rs.fields
strline= strline & x.name & chr(9)
next
'--將表的列名先寫入excel
myfile.writeline strline
do while not rs.eof
strline=""
for each x in rs.fields
strline= strline & x.value & chr(9)
next
'--將表的資料寫入excel
myfile.writeline strline
rs.movenext
loop
end if
rs.close
set rs = nothing
conn.close
set conn = nothing
set myfile = nothing
set fs=nothing
link="open the excel file"
response.write link
end if
%>
2、資料庫相關:
create table [populationperhour] (
[population] [int] not null ,
[hourpos] [int] not null ,
[datepos] [datetime] not null
);insert into populationperhour values('936','1','2001-1-11');
insert into populationperhour values('636','2','2001-1-11');
insert into populationperhour values('106','3','2001-1-11');
insert into populationperhour values('177','4','2001-1-11');
insert into populationperhour values('140','5','2001-1-11');
insert into populationperhour values('114','6','2001-1-11');
insert into populationperhour values('94','7','2001-1-11');
insert into populationperhour values('49','8','2001-1-11');
insert into populationperhour values('88','9','2001-1-11');
insert into populationperhour values('215','10','2001-1-11');
insert into populationperhour values('370','11','2001-1-11');
insert into populationperhour values('550','12','2001-1-11');
insert into populationperhour values('629','13','2001-1-11');
insert into populationperhour values('756','14','2001-1-11');
insert into populationperhour values('833','15','2001-1-11');
insert into populationperhour values('923','16','2001-1-11');
insert into populationperhour values('980','17','2001-1-11');
insert into populationperhour values('957','18','2001-1-11');
insert into populationperhour values('812','19','2001-1-11');
insert into populationperhour values('952','20','2001-1-11');
insert into populationperhour values('1379','21','2001-1-11');
insert into populationperhour values('1516','22','2001-1-11');
insert into populationperhour values('1476','23','2001-1-11');
insert into populationperhour values('1291','24','2001-1-11');
insert into populationperhour values('1028','1','2001-1-12');
insert into populationperhour values('687','2','2001-1-12');
insert into populationperhour values('462','3','2001-1-12');
insert into populationperhour values('317','4','2001-1-12');
insert into populationperhour values('221','5','2001-1-12');
insert into populationperhour values('158','6','2001-1-12');
insert into populationperhour values('127','7','2001-1-12');
insert into populationperhour values('81','8','2001-1-12');
insert into populationperhour values('96','9','2001-1-12');
insert into populationperhour values('192','10','2001-1-12');
insert into populationperhour values('380','11','2001-1-12');
insert into populationperhour values('629','12','2001-1-12');
insert into populationperhour values('745','13','2001-1-12');
insert into populationperhour values('964','14','2001-1-12');
insert into populationperhour values('1012','15','2001-1-12');
insert into populationperhour values('1050','16','2001-1-12');
insert into populationperhour values('1135','17','2001-1-12');
insert into populationperhour values('1130','18','2001-1-12');
insert into populationperhour values('894','19','2001-1-12');
insert into populationperhour values('1026','20','2001-1-12');
insert into populationperhour values('1430','21','2001-1-12');
insert into populationperhour values('1777','22','2001-1-12');
insert into populationperhour values('1759','23','2001-1-12');
insert into populationperhour values('1697','24','2001-1-12');
Oracle刪除乙個庫裡面的所有表
如果有刪除使用者的許可權,則可以 drop user user name cascade 加了cascade就可以把使用者連帶的資料全部刪掉。刪除後再建立該使用者。建立管理員使用者 create user 使用者名稱 identified by 密碼 default tablespace space...
手動寫乙個將資料庫中查詢的內容封裝到物件中
使用反射來獲取指定方法 當為方法的引數設定值時可以使用將引數向上轉型為object 再設到方法上 ublic t handler resultset rs return instance catch exception e 自己實現beanlisthandler class beanlisthand...
將js裡的乙個陣列裡面的值動態地新增到乙個下拉框中
subcat 66 new array 蘇適 書法欣賞 蘇適 subcat 67 new array 劉藝 書法欣賞 劉藝 subcat 68 new array 愛新覺羅 啟驤 書法欣賞 愛新覺羅 啟驤 subcat 69 new array 苗培紅 書法欣賞 苗培紅 onecount 70 fu...