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

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

VB連接SQL數(shù)據(jù)庫(kù)的模塊

2024-07-21 02:21:05
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

public conn as new adodb.connection
public rs as new adodb.recordset
public addflag as boolean



public function opencn() as boolean
dim mag as string
on error goto strerrmag
set conn = new adodb.connection
conn.connectiontimeout = 25
conn.provider = "sqloledb"
conn.properties("data source").value = "127.0.0.1" '服務(wù)器的名字
conn.properties("initial catalog").value = "chart" '庫(kù)名
conn.properties("integrated security").value = "sspi" '登陸類型
conn.open
opencn = true
addflag = true
exit function
strerrmag:
mag = "data can't connect"
call msgbox(mag, vbokcancel, "error:data connect")
addflag = false
end
end function


public sub clocn()
on error resume next
if conn.state <> adstateclosed then conn.close
set conn = nothing
end sub

public function openrs(byval strsql as string) as boolean '連接數(shù)據(jù)庫(kù)記錄集
dim mag as string
dim rpy as boolean
on error goto strerrmag
set rs = new adodb.recordset
if addflag = false then rpy = true
with rs
.activeconnection = conn
.cursorlocation = aduseclient
.cursortype = adopenkeyset
.locktype = adlockoptimistic
.open strsql
end with
addflag = true
openrs = true
exit function
strerrmag:
mag = "data not connect"
call msgbox(mag, vbokcancel, "error:connect")
openrs = false
end
end function
public sub clors()
on error resume next
if rs.state <> adstateclosed then rs.clone
set rs = nothing
end sub



發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 宜阳县| 六安市| 琼中| 湘阴县| 大丰市| 梅河口市| 金堂县| 湘西| 疏勒县| 宁国市| 吕梁市| 赣榆县| 大冶市| 丽江市| 安乡县| 屏南县| 江北区| 昌平区| 南开区| 娄底市| 新田县| 保康县| 江阴市| 达州市| 延吉市| 满洲里市| 含山县| 洛扎县| 礼泉县| 江川县| 乌什县| 巩留县| 定陶县| 象山县| 涪陵区| 仁怀市| 洛隆县| 桓仁| 白河县| 休宁县| 佛学|