时间: 2021-07-31 作者:daque
oledbcommand结构n public sub new()n public sub new(byval cmdtext as string)n public sub new(byval cmdtext as string,byval connection as oledbconnection)n public sub new(byval cmdtext as string,byval connection as oledbconnection,byval transaction as oledbtransaction)参数1. cmdtext 查问的文本。2. connection 一个 oledbconnection,表白与数据源的贯穿。 3. transaction 在个中实行 oledbcommand 的工作。 updatedrowsource属性 获得或树立吩咐截止在由 dbdataadapter 的 update 本领运用时怎样运用于 datarow。默许的 updaterowsource 值为 both,只有机动天生该吩咐(如 oledbcommandbuilder 如许的情景),这时候默许值为 none。在其余非机动天生吩咐情景下,尽管运用代码仍旧经过查问安排器,经过树立吩咐的commandtext属性创造的吩咐东西都是默许值为both。分子称呼 证明both 将输入参数和第一个归来行都映照到 dataset 中的已变动的行。firstreturnedrecord 将第一个归来行中的数据映照到 dataset 中的已变动的行。none 忽视任何归来的参数或行。outputparameters 将输入参数映照到 dataset 中的已变动的行。示例public sub createmyoledbcommand()dim mycommand as new oledbcommand()dim myselectquery as string = "select * from categories order by categoryid"dim mycommand as new oledbcommand(myselectquery)dim myconnection as new oledbconnection ("provider=microsoft.jet.oledb.4.0;data source=nwind_rw.mdb")dim myselectquery as string = "select * from categories order by categoryid"dim mycommand as new oledbcommand(myselectquery, myconnection)dim myconnection as new oledbconnection _ ("provider=microsoft.jet.oledb.4.0;data source=nwind_rw.mdb") myconnection.open() dim mytrans as oledbtransaction = myconnection.begintransaction() dim myselectquery as string = _ "select * from categories order by categoryid" dim mycommand as new oledbcommand(myselectquery, myconnection, mytrans)mycommand.commandtimeout = 20end sub