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

首頁 > 開發 > 綜合 > 正文

vb連接sql模塊代碼

2024-07-21 02:24:53
字體:
來源:轉載
供稿:網友

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

public function opencn(byval cip as string) 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 = cip    '服務器的名字
conn.properties("initial catalog").value = "zqoa"           '庫名
'conn.properties("integrated security").value = "sspi"   '登陸類型
conn.properties("user id").value = "sa"
conn.properties("password").value = "sa"
conn.open
opencn = true
addflag = true
exit function
strerrmag:
    mag = "data can't connect"
    call msgbox(mag, vbokonly, "error:data connect")
    addflag = false
    exit function
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   '連接數據庫記錄集
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
    end
    'exit function
strerrmag:
    mag = "data not connect"
    call msgbox(mag, vbokonly, "error:connect")
    openrs = false
    end
    'exit function
end function
public sub clors()
on error resume next
if rs.state <> adstateclosed then rs.clone
set rs = nothing
end sub


 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 泗水县| 富蕴县| 霍山县| 时尚| 卢氏县| 铜鼓县| 多伦县| 楚雄市| 南康市| 太湖县| 六盘水市| 民县| 临泽县| 崇文区| 正镶白旗| 建水县| 射洪县| 嘉祥县| 甘德县| 云浮市| 石景山区| 驻马店市| 清水县| 花莲市| 大田县| 武定县| 昆明市| 清镇市| 武平县| 晋江市| 丹东市| 密山市| 吉林市| 长兴县| 赤峰市| 长汀县| 辉县市| 紫阳县| 米林县| 麻江县| 陇西县|