vb操作access資料庫,如何判斷表中是否存在某欄位

時間 2021-10-14 22:24:01

1樓:

1.加個adodc空間

2.這個空間的資料來源連結到access

3. 令 adodc1.recordsource =.select * from table where 欄位=' xx' (table是你的表名,xx是你要查詢的內容)

adodc1.refresh

if adodc1.recordset.recordcount <1 then

adodc1.recordset.new

…………加你要的內容…………

end if

2樓:

如果是sql,會用下述語句處理,access沒試過,可能原理也類似if not exists (select a.name from syscolumns a,sysobjects b

where a.id=b.id

and ltrim(a.name)='col_name' and ltrim(b.name)='tablename')

alter table [tablename] add [col_name] char(3) nullgo

VB查詢ACCESS資料庫問題

正確的寫法應該是 s select express from filetype where name text1.text sqlext s 在s中使用單引號把文字內容括起來,使s成為例如 select express from filetype where name test 返回到textbox...

java操作access資料庫如何插入,修改資料給個完整的例子謝謝

connection con 資料庫介面statement sta 對資料庫操作的類resultset res 接收資料的包string str 連線資料庫用到的字串try 連線資料庫 dbq 庫的檔名.mdb class.forname sun.jdbc.odbc.jdbcodbcdriver c...

vb中如何把access資料庫的內容賦值給二維陣列

馮益斌 說說思路 這個顯然要用ado 1 連線資料庫,得到連線物件conn 2 用下面的select語句開啟表,將資料讀入recordsetset rs conn.execute select from 表名 3 用迴圈將資料讀入二維陣列arr row 0 while not rs.eof arr ...