国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

在VB中動(dòng)態(tài)創(chuàng)建數(shù)據(jù)庫

2024-07-21 02:13:34
字體:
供稿:網(wǎng)友

在vb中動(dòng)態(tài)創(chuàng)建數(shù)據(jù)庫
新建工程.添加控件 對(duì)應(yīng)寫上代碼

以下為引用的內(nèi)容:
private sub command2_click()
    dim mydb as dao.database
    'set mydb = dao.opendatabase("d:/mydb3.mdb")
    set mydb = dao.opendatabase(app.path + "/mydb.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")
    set mydb = dao.opendatabase(app.path + "/mydb.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)
     set mydb = dao.workspaces(0).createdatabase(app.path + "/mydb.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 "成功創(chuàng)建mydb3.mdb數(shù)據(jù)庫外加一條記錄litao 21"
    end sub 

private sub command1_click()
    dim mydb as dao.database
    'set mydb = dao.opendatabase("d:/mydb3.mdb")
    set mydb = dao.opendatabase(app.path + "/mydb.mdb")
    dim c as string
    c = "insert into newtable1 values ('liqiao','20')"
    mydb.execute c
msgbox "成功插入一條記錄liqiao 20"
end sub

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 民勤县| 永康市| 定南县| 涞源县| 集安市| 叶城县| 九江县| 博乐市| 德清县| 汨罗市| 元朗区| 巴彦淖尔市| 夏津县| 仁怀市| 新疆| 潮安县| 富宁县| 青海省| 石景山区| 五台县| 二手房| 祥云县| 安仁县| 鄄城县| 池州市| 天气| 临朐县| 青浦区| 双柏县| 泰宁县| 千阳县| 余姚市| 余庆县| 三江| 鱼台县| 林周县| 黄陵县| 张掖市| 湄潭县| 雅安市| 晋州市|