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

首頁 > 編程 > .NET > 正文

ADO.NET對象的構(gòu)造(1)_OleDbDataAdapter

2024-07-10 13:05:24
字體:
供稿:網(wǎng)友
oledbdataadapter 構(gòu)造



n public sub new()
n public sub new(byval selectcommand as oledbcommand)

n public sub new(byval selectcommandtext as string,byval selectconnection as oledbconnection)

n public sub new(byval selectcommandtext as string,byval selectconnectionstring as string)



參數(shù)

selectcommand oledbcommand,它是 select 語句或存儲過程,被設(shè)置為 oledbdataadapter 的 selectcommand 屬性。
selectcommandtext 一個字符串,它是 sql select 語句或?qū)⒂?oledbdataadapter 的 selectcommand 屬性使用的存儲過程。
selectconnection 表示連接的 oledbconnection。
selectconnectionstring 連接字符串。


備注

當(dāng)創(chuàng)建 oledbdataadapter 的實例時,下面的讀/寫屬性將設(shè)置為以下初始值。

properties
初始值

missingmappingaction
missingmappingaction.passthrough

missingschemaaction
missingschemaaction.add





可以通過單獨調(diào)用屬性來更改任何這些屬性的值。



示例

public sub createoledbdataadapter()

dim myoledbconnection as oledbconnection = new oledbconnection("provider=sqloledb;data source=localhost;integrated security=sspi;initial catalog=northwind")



dim custda as oledbdataadapter = new oledbdataadapter



dim myoledbcommand as oledbcommand = new oledbcommand("select customerid, companyname from customers", myoledbconnection)

dim custda as oledbdataadapter = new oledbdataadapter(myoledbcommand)



dim myselecttext as string = "select customerid, companyname from customers"

dim custda as oledbdataadapter = new oledbdataadapter(myselecttext, myoledbconnection)



dim myselecttext as string = "select customerid, companyname from customers"

dim myconnstring as string = "provider=sqloledb;data source=localhost;integrated security=sspi;initial catalog=northwind"

dim custda as oledbdataadapter = new oledbdataadapter(myselecttext, myconnstring)



custda.missingschemaaction = missingschemaaction.addwithkey



custda.selectcommand = new oledbcommand("select customerid, companyname from customers", myoledbconnection)

custda.insertcommand = new oledbcommand("insert into customers (customerid, companyname) values (?, ?)", myoledbconnection)

custda.updatecommand = new oledbcommand("update customers set customerid = ?, companyname = ? where customerid = ?", myoledbconnection)

custda.deletecommand = new oledbcommand("delete from customers where customerid = ?", myoledbconnection)



custda.insertcommand.parameters.add("@customerid", oledbtype.char, 5, "customerid")

custda.insertcommand.parameters.add("@companyname", oledbtype.varchar, 40, "companyname")



custda.updatecommand.parameters.add("@customerid", oledbtype.char, 5, "customerid")

custda.updatecommand.parameters.add("@companyname", oledbtype.varchar, 40, "companyname")

custda.updatecommand.parameters.add("@oldcustomerid", oledbtype.char, 5, "customerid").sourceversion = datarowversion.original



custda.deletecommand.parameters.add("@customerid", oledbtype.char, 5, "customerid").sourceversion = datarowversion.original

end sub



(信息整理來自msdn)



發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 怀仁县| 竹溪县| 满洲里市| 科尔| 淳化县| 梓潼县| 松桃| 绥德县| 连城县| 阿鲁科尔沁旗| 望奎县| 汤阴县| 南宁市| 桑日县| 博罗县| 临沧市| 弥勒县| 华安县| 吴桥县| 东城区| 大足县| 绍兴县| 凉城县| 金堂县| 丹寨县| 锡林郭勒盟| 揭西县| 喀什市| 扎赉特旗| 五河县| 高青县| 闽侯县| 交城县| 偏关县| 东乡县| 玉田县| 霍山县| 汶川县| 裕民县| 高平市| 额济纳旗|