新建工程.新增控制項 對應寫上**
private sub command2_click()
dim mydb as dao.database
'set mydb = dao.opendatabase("d:/mydb3.mdb")
dim d as string
d = "delete * from newtable1"
mydb.execute d
msgbox "成功刪除全部記錄"
end sub
private sub command3_click()
dim mydb as dao.database
'set mydb = dao.opendatabase("d:/mydb3.mdb")
dim e as string
e = "drop table newtable1"
mydb.execute e
end sub
private sub form_load()
dim mydb as dao.database
'set mydb = dao.workspaces(0).createdatabase("d:/mydb3.mdb", dblanggeneral)
dim str_sql as string
str_sql = "create table newtable1(field1 text(10),field2 short)"
mydb.execute str_sql
dim a as string
a = "insert into newtable1 values ('litao','21')"
mydb.execute a
str_sql = "create table newtable2(field1 text(10),field2 short)"
mydb.execute str_sql
mydb.close
msgbox "成功建立mydb3.mdb資料庫外加一條記錄litao 21"
end sub
private sub command1_click()
dim mydb as dao.database
'set mydb = dao.opendatabase("d:/mydb3.mdb")
dim c as string
c = "insert into newtable1 values ('liqiao','20')"
mydb.execute c
msgbox "成功插入一條記錄liqiao 20"
end sub
Delphi中動態建立Access資料庫和資料表
一 通過ole方式建立 相信各位都用通過ole方式訪問word excel檔案的經歷,具體我不說太多,直接把具體 寫出來就完了 在引用部分加入 uses comobj 實現部分 procedure tformoffice.bitbtn1click sender tobject varcreateac...
動態建立資料庫例項
動態建立資料庫例項 輸入引數為資料庫名 儲存的路徑名,資料庫檔名與資料庫名稱相同 usemaster godeclare dbname sysname path sysname select dbname convert varchar getdate 112 path d data ifdb id...
動態建立ACCESS資料庫
1 通過ole方式建立 uses comobj procedure tformoffice.bitbtn1click sender tobject varcreateaccess olevariant begin createaccess createoleobject adox.catalog c...