VB資料庫操作命令

2021-04-07 07:28:48 字數 1522 閱讀 9106

連線資料庫

引用 microsoft activex data objects 2.8 library

private sub form_load()

dim cnn as adodb.connection

set cnn = new adodb.connection

cnn.provider = "microsoft.jet.oledb.4.0"

dim cnnfile as string

cnnfile = "data source=d:/db.mdb;persist security info=false;jet oledb:database password=123456789"

cnn.open cnnfile

dim rs as adodb.recordset

set rs = new adodb.recordset

rs.open table, cnn, , adlockreadonly

set me.mshflexgrid1.datasource = cnn2.execute("select * from table")

'ado 連線 加密access資料庫

cnn2string = "provider=microsoft.jet.oledb.4.0;data source=" & "d:/db.mdb;persist security info=false;jet oledb:database password=123456789"

新增strsql = "insert into user_table(userid,userpwd,userlevel,userinfo) values('" & text1(0).text & "','" & text1(1).text & "','" & combo1.text & "','" & text1(2).text & "')"

rs.open strsql, cnn, adopendynamic, adlockoptimistic

刪除strsql = "delete from user_table where userid='" & text1(0).text & "'"

rs.open strsql, cnn, adopendynamic, adlockoptimistic

update

strsql = "select * from user_table where userid='" & text1(0).text & "'"

rs.open strsql, cnn, adopendynamic, adlockoptimistic

rs.update "userpwd", text1(1).text

rs.update "userlevel", combo1.text

rs.update "userinfo", text1(2).text

或 update 資料表名 set 新資料值 where 條件表示式

update user_table set userpwd=text1(1).text where userid=text1(0).text

VB通用資料庫操作方法

1.vb通用資料操作方法。2.通用資料庫查詢方法。3.通用資料庫操作方法。erp查詢資料庫 public function yzquery sqls as string,msgstring as string as adodb.recordset on error goto executesql e...

VB使用ADO操作Access資料庫

這裡只是個簡單不能再簡單的vb小程式例項,但它包含這幾個關鍵字 vb6.0 ado access 環境 visual basic 6.0 企業版 非精簡版,不然會缺少必須的控制元件 資料庫 access資料庫,資料庫是xs.mbd,內建表為xj 結果 vb使用ado連線access資料庫,查詢xj表...

VB與資料庫 資料庫連線

話說學生管理系統和機房收費系統都完成了,再回來說資料庫的連線真的好嗎?貌似不太好,但是誰讓自己欠賬了呢 除了還,還能有更好的解決方法嗎?前幾天說 紅皮書 中的七個物件。當時的反應哪七個,腦子完全一片空白,不知所云。所以找出來,再看看吧。vb6.0與sqlserver有源資料庫連線,vb6.0中資料訪...

flask資料庫操作命令

資料庫增加,刪除,修改操作 增加 user user name laowang db.session.add user db.session.commit 修改 user.name xiaohua db.session.commit 刪除 db.session.delete user db.sess...

redis 資料庫操作命令

redis的資料庫操作命令包括select命令和move命令.redis select命令 redis select命令的格式為select index,其含義是為當前客戶端選擇使用哪一個全域性資料庫.redis伺服器預設有16個全域性資料庫,當新客戶端連線到redis伺服器時,使用的是第一個 索引...