VB中远程数据库的访问(3)-应用举例(2)

2008-02-23 06:52:47来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折



private sub cmdOK_click()

on error goto errhandler:

strdb = text2.text

' 本 地 数 据 库 名 及 路 径

linktdfname = text3.text

' 本 地 数 据 库 中 新 建 的 链 接 远 程 表 的 表 名

strcn = strrodb ' 连 接 字 符 串

strtdf = combo1.text ' 指 定 远 程 数 据 库 中 要 访 问 的 表

' 调 用linktable 过 程

call linktable(strdb, strrodb, strcn, strtdf, linktdfname)

' 调 用rst_display 过 程

call rst_display(strdb, linktdfname, form1)

form2.hide

form1.show

form1.caption = " 远 程 数 据:" strcn "-" strtdf

' 显 示“ 添 加”,“ 删 除”,“ 修 改” 控 件

form1.cmdadd.visible = true

form1.cmddel.visible = true

form1.cmdmodify.visible = true

errhandler:

select case err

case 0

response = 0

case else

msgbox (error vbr " 重 新 输 入")

exit sub

end select

end sub

private sub combo1_gotfocus()

strrodb = text1.text ' 指 定 远 程 数 据 库 名 及 路 径

set rodbs = opendatabase(strrodb) ' 打 开 远 程 数 据 库

' 删 除combo1 中 的 内 容

if combo1.listcount >= 1 then

for i = combo1.listcount - 1 to 0 step -1

combo1.removeitem i

next i

end if

' 把 数 据 库 中 的 表 名 加 到combo1 中

for i = 0 to rodbs.tabledefs.count - 1

combo1.additem rodbs.tabledefs(i).name

next i

end sub

上一篇: VB数据库数据的选项录入及选项增减与编辑
下一篇: VB中播放WAV文件

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:实现Access数据库的Web查询

下一篇:用OLE自动化Outlook