上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
aforangel
註冊時間: 2010-05-24 文章: 117
第 1 樓
|
發表於: 星期二 六月 22, 2010 9:11 am 文章主題: 請教有關APPEND資料...有點急!! |
|
|
student.dbf 裡面有18000個紀錄, 我用單機程式執行以下程序...花時差不多2分鐘, 如果放在SERVER上還要更長時間, 有什麼方法..可以另temp.dbf新增更快, 這速度用家實在接受不到, 謝謝各位大大....小弟初學寫PROGRAM, 技術有限
? time()
select student
go top
do while !eof()
if age > 12
scatter memvar memo
select temp
append blank
if rlock()
gather memvar memo
unlock
endif
endif
select student
skip
enddo
? time() |
|
回頂端 |
|
|
ckp6250
註冊時間: 2004-07-30 文章: 1644
第 2 樓
|
發表於: 星期二 六月 22, 2010 9:15 am 文章主題: |
|
|
select * from student where age > 12 into table temp.dbf |
|
回頂端 |
|
|
aforangel
註冊時間: 2010-05-24 文章: 117
第 3 樓
|
發表於: 星期二 六月 22, 2010 11:34 am 文章主題: |
|
|
感謝CKP兄, 不過又有另一個問題
public temp_Dbf, tempSel1, temp_Ntx
select student
temp_Dbf = Sys(2015)
temp_Ntx = temp_Dbf
copy stru to &temp_Dbf
select 0
use &temp_Dbf excl alias t_case
index on studentcode tag &temp_Ntx
select t_case
select * from student where age > 12 into table t_case
go top
with thisform.grid2
.recordsource = temp_Dbf
.column1.controlsource = temp_Dbf+".studentcode" <--- 程式執行到這行就說找不到別名, 請問錯了什麼?
.column2.controlsource = temp_Dbf+".sex"
.column3.controlsource = temp_Dbf+".age"
endwith |
|
回頂端 |
|
|
LiuRambo
註冊時間: 2007-11-27 文章: 481
第 4 樓
|
發表於: 星期二 六月 22, 2010 12:06 pm 文章主題: |
|
|
select t_case
select * from student where age > 12 into table t_case
go top
with thisform.grid2
.recordsource = temp_Dbf
.column1.controlsource = temp_Dbf+".studentcode" <--- 程式執行到這行就說找不到別名, 請問錯了什麼?
既然都已經新增一個T_CASE了
怎麼還是用TEMP_DBF |
|
回頂端 |
|
|
aforangel
註冊時間: 2010-05-24 文章: 117
第 5 樓
|
發表於: 星期二 六月 22, 2010 1:23 pm 文章主題: |
|
|
LiuRambo兄
意思是將所有temp_Dbf 都轉做t_case嗎?
.recordsource = t_case
.column1.controlsource = t_case+".studentcode" |
|
回頂端 |
|
|
LiuRambo
註冊時間: 2007-11-27 文章: 481
第 6 樓
|
發表於: 星期二 六月 22, 2010 1:41 pm 文章主題: |
|
|
recordsource = "t_case"
.column1.controlsource = "t_case.studentcode"
.column2.controlsource = "t_case.sex"
.column3.controlsource = "t_case.age" |
|
回頂端 |
|
|
aforangel
註冊時間: 2010-05-24 文章: 117
第 7 樓
|
發表於: 星期二 六月 22, 2010 3:18 pm 文章主題: |
|
|
現在, 為什麼我之前已設好索引檔, 但我在後面用SEEK會說我沒設好
public temp_Dbf, tempSel1, temp_Ntx
select student
temp_Dbf = Sys(2015)
temp_Ntx = temp_Dbf
copy stru to &temp_Dbf
select 0
use &temp_Dbf excl alias t_case
index on studentcode tag &temp_Ntx <---設定索引
select t_case
select * from student where age > 12 into table t_case
go top
with thisform.grid2
recordsource = "t_case"
.column1.controlsource = "t_case.studentcode"
.column2.controlsource = "t_case.sex"
.column3.controlsource = "t_case.age"
endwith
select t_case
seek "12345" <--- 資料表格沒有設定索引次序 |
|
回頂端 |
|
|
aforangel
註冊時間: 2010-05-24 文章: 117
第 8 樓
|
發表於: 星期二 六月 22, 2010 3:50 pm 文章主題: |
|
|
找到了, 原來用SELECT * 設定索引檔是用在中間加插order by...
select * from student order by studentcode into table &dbfD1 <--- 這是成功的
但是, 如果我的索引是要studentcode + sex, 請問要怎打
select * from student order by studentcode+sex into table &dbfD1 <--- 這會顯示錯誤..... |
|
回頂端 |
|
|
ckp6250
註冊時間: 2004-07-30 文章: 1644
第 9 樓
|
發表於: 星期二 六月 22, 2010 4:02 pm 文章主題: |
|
|
select * from student order by studentcode,sex into table &dbfD1
建議aforangel兄把 select 指令用力啃30遍(300遍也可以,看您的時間)
將來對您很有幫助
select 如果用的好,常常100行指令只要用一行 select 就完成了
ckp6250 在 星期二 六月 22, 2010 4:19 pm 作了第 1 次修改 |
|
回頂端 |
|
|
pilipala
註冊時間: 2009-05-13 文章: 75
第 10 樓
|
發表於: 星期二 六月 22, 2010 4:10 pm 文章主題: |
|
|
aforangel 寫到: | 現在, 為什麼我之前已設好索引檔, 但我在後面用SEEK會說我沒設好
index on studentcode tag &temp_Ntx <---設定索引
select t_case
seek "12345" <--- 資料表格沒有設定索引次序 |
要使用Seek前,必須明確指定要用那一個Index(事先已建立好),
select t_case
set order to &temp_Ntx
seek "12345" |
|
回頂端 |
|
|
syntech
註冊時間: 2003-05-16 文章: 4212 來自: Taipei,Taiwan
第 11 樓
|
發表於: 星期二 六月 22, 2010 4:15 pm 文章主題: |
|
|
這篇有蓋大樓的潛力............. _________________ 如果公司有下列困擾:
1. 找不到便宜,快速,簡易的 生產排程軟體
2. 不知道如何快速排定 採購計劃
3. 成本抓不準,自己算比軟體算有用
4. 想學習系統規劃,想找系統架構的顧問
請聯絡我們,也許我們幫得上忙 |
|
回頂端 |
|
|
aforangel
註冊時間: 2010-05-24 文章: 117
第 12 樓
|
發表於: 星期二 六月 22, 2010 4:24 pm 文章主題: |
|
|
謝謝各位.....學習中..
ckp6250, 請問, 那裡有關於SELECT 的文章可以參考....我也想努力努力 |
|
回頂端 |
|
|
aforangel
註冊時間: 2010-05-24 文章: 117
第 13 樓
|
發表於: 星期二 六月 22, 2010 4:46 pm 文章主題: |
|
|
用完select 之後...
select * from student order by studentcode,sex into table &dbfD1
最後我離開前想delete這個TEMP FILE..dbfD1
select dbfD1
use
Erase dbfD1+".dbf" <-- 錯誤"檔案被使用"...請問用完select後要先做什麼動作關閉select 嗎?.....希望這是最後一個暫時遇到關於select的問題吧....>_<
Erase dbfD1+".cdx"
Erase dbfD1+".fpt" |
|
回頂端 |
|
|
richshih
註冊時間: 2007-10-11 文章: 153
第 14 樓
|
發表於: 星期二 六月 22, 2010 5:29 pm 文章主題: |
|
|
我看你是用 into table &dbfD1
要關閉須use in (dbfD1) |
|
回頂端 |
|
|
ckp6250
註冊時間: 2004-07-30 文章: 1644
第 15 樓
|
發表於: 星期二 六月 22, 2010 5:43 pm 文章主題: |
|
|
aforangel 寫到: |
那裡有關於SELECT 的文章可以參考 |
在市面上,有幾本外國人寫的,叫做「SQL 聖經」「SQL 概論」之類的,反正整本都在講 SQL 的理論,原則,觀念...,買幾本回來吧,值得的。
注意,不是那種微軟的 ms sql server 2008 之類的哦, |
|
回頂端 |
|
|
|