国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 翼城县| 连州市| 柳州市| 慈利县| 高雄县| 甘谷县| 襄城县| 常州市| 潼南县| 班玛县| 海淀区| 蓝山县| 嫩江县| 阳原县| 满城县| 贡觉县| 海南省| 乌鲁木齐县| 尉氏县| 保德县| 聂荣县| 山东| 云龙县| 射阳县| 莆田市| 洛川县| 五寨县| 临海市| 河北省| 冀州市| 赤峰市| 台中市| 疏勒县| 离岛区| 芜湖县| 娱乐| 偏关县| 金平| 天柱县| 平罗县| 琼海市|