Dataset+TableAdapter _.net最终数据访问类出现? 我的心血显然被藐视了

随着不断深入了解 2005 team suit 的IDE
我发现我错怪了M$    m$正在以一种极端激进的方式改变我们的数据访问模式

在.net 1.1框架下编写自己的数据访问类时 我曾经抱怨过   如果M$的dataset 能够像组件一样 可以把各种各样的 DataAdepter捆绑进去该多好啊   这样数据储存器和数据I/O就可以一起发布了  编写也方便,何苦要建立DataAccess工程阿

现在的Dataset 基本上满足了我幻想初步的一切需求: 拖拽数据表、 生成数据结构和填充器(TableAdapter)  、对每个填充器强类型化(编写程序的时候可以通过vs IDE提示来减少工作量 改写和阅读也更清晰)、每个填充器捆绑若干种强类型化select查询限定(以前每次都要自己写where 混乱不说 每个dataadapter 修改了selectcommand以后就成了巨大的废物)。。。。。种种功能都是我那被废弃的数据访问费尽千辛万苦达到了的或费尽千辛万苦也没能达到的。。

于是我开始利用这个构架疯狂的升级了我手头所有的工程!

作为纪念  把我曾经的心血贴出来  里面很多功能和现在的dataset 从思想根源是一致的

这个数据访问类是以dataset为存储核心 使用的时候  把这个组件拖到有dataadpter 和dataadapter生成数据集的地方(窗体 组件 服务皆可)  然后用MountDataAdepters()方法把dataadpters 全都引用就可以使用了


ContractedBlock.gif ExpandedBlockStart.gif 永别了~曾经的数据访问类
  1None.gifImports WayneWorks
  2None.gifImports WayneWorks.Toolkits
  3None.gifImports System.Data
  4None.gifImports System.Data.SqlClient
  5None.gifImports System.Data.OleDb
  6None.gifImports System.Data.Odbc
  7None.gifImports System.Data.OracleClient
  8None.gif
  9ExpandedBlockStart.gifContractedBlock.gifPublic Class DataAccessComponent1_1Class DataAccessComponent1_1
 10InBlock.gif    '基础据访问类
 11InBlock.gif    '用例 在继承的新类 New()函数中指定 dsAllTables 和 DBConnection
 12InBlock.gif    '并且将所有拖拽得到的 IDataAdepter 放入list
 13InBlock.gif    'DA2List(Me.SqlDataAdapter1, DACols)
 14InBlock.gif    'DA2List(Me.SqlDataAdapter2, DACols)
 15InBlock.gif    'DA2List(Me.SqlDataAdapter3, DACols)
 16InBlock.gif    'DA2List(Me.SqlDataAdapter4, DACols)
 17InBlock.gif    'DA2List(Me.SqlDataAdapter5, DACols)
 18InBlock.gif    'DA2List(Me.SqlDataAdapter6, DACols)
 19InBlock.gif    'DA2List(Me.SqlDataAdapter7, DACols)
 20InBlock.gif    'DA2List(Me.SqlDataAdapter8, DACols)
 21InBlock.gif
 22InBlock.gif    Inherits System.ComponentModel.Component
 23InBlock.gif
 24InBlock.gif
 25InBlock.gif
 26ContractedSubBlock.gifExpandedSubBlockStart.gif自定义的全局量#Region " 自定义的全局量 "
 27InBlock.gif
 28InBlock.gif
 29InBlock.gif
 30InBlock.gif    Protected DACols As New SortedList  '所有的DA列表
 31InBlock.gif    Protected WithEvents DsAllTables As DataSet  '全局的数据集
 32InBlock.gif    Protected DBConnection As IDbConnection
 33InBlock.gif    Protected ConstStr As String
 34InBlock.gif    Protected ConstArray() As String  '除了cst开头的表 所有常量表名
 35InBlock.gif
 36InBlock.gif
 37ExpandedSubBlockEnd.gif#End Region

 38InBlock.gif
 39ContractedSubBlock.gifExpandedSubBlockStart.gif组件设计器生成的代码#Region " 组件设计器生成的代码 "
 40InBlock.gif
 41InBlock.gif
 42InBlock.gif
 43ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Sub New()Sub New(ByVal Container As System.ComponentModel.IContainer)
 44InBlock.gif        MyClass.New()
 45InBlock.gif
 46InBlock.gif
 47InBlock.gif        'Windows.Forms 类撰写设计器支持所必需的
 48InBlock.gif        Container.Add(Me)
 49ExpandedSubBlockEnd.gif    End Sub

 50InBlock.gif
 51ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Sub New()Sub New()
 52InBlock.gif        MyBase.New()
 53InBlock.gif
 54InBlock.gif        '该调用是组件设计器所必需的。
 55InBlock.gif        'InitializeComponent()
 56InBlock.gif
 57InBlock.gif        ''在 InitializeComponent() 调用之后添加任何初始化
 58InBlock.gif        ''   Dim ConstString As String = ""  ' "ADD_Roles,ADD_RolePowers,ADD_RoleList"
 59InBlock.gif        'Dim ViewString As String = ""  '"CardMountsCardCount,vwProcessCount,vwProcessSameCount,vwServerUserCount"
 60InBlock.gif        ' ConstArray = Split(ConstString, ",")
 61InBlock.gif
 62InBlock.gif
 63InBlock.gif
 64InBlock.gif        'DA2List()
 65InBlock.gif
 66InBlock.gif        'Me.DACols.Clear()
 67InBlock.gif
 68InBlock.gif        'DA2List(Me.SqlDataAdapter1, DACols)
 69InBlock.gif        'DA2List(Me.SqlDataAdapter2, DACols)
 70InBlock.gif        'DA2List(Me.SqlDataAdapter3, DACols)
 71InBlock.gif        'DA2List(Me.SqlDataAdapter4, DACols)
 72InBlock.gif        'DA2List(Me.SqlDataAdapter5, DACols)
 73InBlock.gif        'DA2List(Me.SqlDataAdapter6, DACols)
 74InBlock.gif        'DA2List(Me.SqlDataAdapter7, DACols)
 75InBlock.gif        'DA2List(Me.SqlDataAdapter8, DACols)
 76InBlock.gif        'DA2List(Me.SqlDataAdapter9, DACols)
 77InBlock.gif        'DA2List(Me.SqlDataAdapter10, DACols)
 78InBlock.gif        'DA2List(Me.SqlDataAdapter11, DACols)
 79InBlock.gif        'DA2List(Me.SqlDataAdapter12, DACols)
 80InBlock.gif        'DA2List(Me.SqlDataAdapter13, DACols)
 81InBlock.gif        'DA2List(Me.SqlDataAdapter14, DACols)
 82InBlock.gif        'DA2List(Me.SqlDataAdapter15, DACols)
 83InBlock.gif        'DA2List(Me.SqlDataAdapter16, DACols)
 84InBlock.gif        'DA2List(Me.SqlDataAdapter17, DACols)
 85InBlock.gif        'DA2List(Me.SqlDataAdapter18, DACols)
 86InBlock.gif        'DA2List(Me.SqlDataAdapter19, DACols)
 87InBlock.gif        'DA2List(Me.SqlDataAdapter20, DACols)
 88InBlock.gif        'DA2List(Me.SqlDataAdapter21, DACols)
 89InBlock.gif        'DA2List(Me.SqlDataAdapter22, DACols)
 90InBlock.gif        'DA2List(Me.SqlDataAdapter23, DACols)
 91InBlock.gif        'DA2List(Me.SqlDataAdapter24, DACols)
 92InBlock.gif        'DA2List(Me.SqlDataAdapter25, DACols)
 93InBlock.gif        'DA2List(Me.SqlDataAdapter26, DACols)
 94InBlock.gif        'DA2List(Me.SqlDataAdapter27, DACols)
 95InBlock.gif        'DA2List(Me.SqlDataAdapter28, DACols)
 96InBlock.gif        'DA2List(Me.SqlDataAdapter29, DACols)
 97InBlock.gif        '   DA2List(Me.SqlDataAdapter30, DACols)
 98InBlock.gif        '  DA2List(Me.SqlDataAdapter31, DACols)
 99ExpandedSubBlockEnd.gif    End Sub

100InBlock.gif
101InBlock.gif
102InBlock.gif
103InBlock.gif
104InBlock.gif    '组件重写 dispose 以清理组件列表。
105ExpandedSubBlockStart.gifContractedSubBlock.gif    Protected Overloads Overrides Sub Dispose()Sub Dispose(ByVal disposing As Boolean)
106InBlock.gif        If disposing Then
107InBlock.gif            If Not (components Is NothingThen
108InBlock.gif                components.Dispose()
109InBlock.gif            End If
110InBlock.gif        End If
111InBlock.gif        MyBase.Dispose(disposing)
112ExpandedSubBlockEnd.gif    End Sub

113InBlock.gif
114InBlock.gif    '组件设计器所必需的
115InBlock.gif    Protected components As System.ComponentModel.IContainer
116InBlock.gif
117InBlock.gif    '注意: 以下过程是组件设计器所必需的
118InBlock.gif    '可以使用组件设计器修改此过程。
119InBlock.gif    '不要使用代码编辑器修改它。
120InBlock.gif
121InBlock.gif
122InBlock.gif
123InBlock.gif
124ExpandedSubBlockEnd.gif#End Region

125InBlock.gif
126InBlock.gif
127InBlock.gif
128InBlock.gif
129ContractedSubBlock.gifExpandedSubBlockStart.gif功能实现代码#Region "功能实现代码"
130InBlock.gif
131InBlock.gif
132InBlock.gif    '分析一组DA确定它的表名
133ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Sub MountDataAdepters()Sub MountDataAdepters(ByVal ParamArray DataAdepters() As Object)
134InBlock.gif        Me.DACols.Clear()
135InBlock.gif
136InBlock.gif        For Each da As Object In DataAdepters
137InBlock.gif
138InBlock.gif            Dim ms As ITableMappingCollection = da.TableMappings
139InBlock.gif            Dim m As ITableMapping = ms(0)
140InBlock.gif            DACols.Add(m.DataSetTable, da)
141InBlock.gif        Next
142InBlock.gif
143ExpandedSubBlockEnd.gif    End Sub

144InBlock.gif
145ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Property ConstTableName()Property ConstTableName() As String()
146InBlock.gif        Get
147InBlock.gif            Return ConstArray
148InBlock.gif        End Get
149InBlock.gif
150InBlock.gif        Set(ByVal Array As String())
151InBlock.gif            ConstArray = Array
152InBlock.gif
153InBlock.gif
154InBlock.gif        End Set
155InBlock.gif
156ExpandedSubBlockEnd.gif    End Property

157InBlock.gif
158InBlock.gif
159ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Property BaseDataSet()Property BaseDataSet() As DataSet
160InBlock.gif
161InBlock.gif        Get
162InBlock.gif            Return DsAllTables
163InBlock.gif        End Get
164InBlock.gif        Set(ByVal Value As DataSet)
165InBlock.gif            DsAllTables = Value
166InBlock.gif        End Set
167ExpandedSubBlockEnd.gif    End Property

168InBlock.gif
169ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Property DBConn()Property DBConn() As Data.IDbConnection
170InBlock.gif
171InBlock.gif        Get
172InBlock.gif            Return DBConnection
173InBlock.gif        End Get
174InBlock.gif        Set(ByVal Value As Data.IDbConnection)
175InBlock.gif            Me.DBConnection = Value
176InBlock.gif        End Set
177ExpandedSubBlockEnd.gif    End Property

178InBlock.gif
179ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable ReadOnly Property ConstTables()Property ConstTables() As System.Collections.SortedList
180InBlock.gif        Get
181InBlock.gif            Dim r As New SortedList
182InBlock.gif            For Each s As String In ConstArray
183InBlock.gif                r.Add(s, DsAllTables.Tables(s))
184InBlock.gif
185InBlock.gif            Next
186InBlock.gif            For Each t As DataTable In Me.DsAllTables.Tables
187InBlock.gif                If t.TableName.StartsWith("cst"Then
188InBlock.gif                    r.Add(t.TableName, t)
189InBlock.gif                End If
190InBlock.gif
191InBlock.gif            Next
192InBlock.gif            Return r
193InBlock.gif
194InBlock.gif        End Get
195ExpandedSubBlockEnd.gif    End Property

196InBlock.gif
197InBlock.gif
198InBlock.gif
199InBlock.gif
200InBlock.gif
201ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Sub RefreshConst()Sub RefreshConst()
202InBlock.gif        Dim tmpda As IDataAdapter
203InBlock.gif        For Each v As Collections.DictionaryEntry In Me.DataAdepterList
204InBlock.gif            If CStr(v.Key).StartsWith("cst"Then
205InBlock.gif                DsAllTables.Tables(v.Key).Clear()
206InBlock.gif                tmpda = v.Value
207InBlock.gif                tmpda.Fill(Me.DsAllTables)
208InBlock.gif            End If
209InBlock.gif
210InBlock.gif        Next
211InBlock.gif
212InBlock.gif
213InBlock.gif        For Each s As String In Me.ConstArray
214InBlock.gif
215InBlock.gif            If DACols.ContainsKey(s) Then
216InBlock.gif                DsAllTables.Tables(s).Clear()
217InBlock.gif                tmpda = DACols(s)
218InBlock.gif                tmpda.Fill(Me.DsAllTables)
219InBlock.gif            End If
220InBlock.gif        Next
221InBlock.gif
222ExpandedSubBlockEnd.gif    End Sub

223InBlock.gif
224InBlock.gif
225InBlock.gif
226ExpandedSubBlockStart.gifContractedSubBlock.gif    Sub LoadConst()Sub LoadConst(ByVal xml As String)
227InBlock.gif        Dim sr As System.IO.StringReader = New System.IO.StringReader(xml)
228InBlock.gif        BaseDataSet.ReadXml(sr)
229InBlock.gif        BaseDataSet.AcceptChanges()
230ExpandedSubBlockEnd.gif    End Sub

231InBlock.gif
232ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Sub Update()Sub Update()
233InBlock.gif        Dim tmpda As IDataAdapter
234InBlock.gif        For Each s As String In DACols.Keys
235InBlock.gif            'If Array.IndexOf(Me.ConstArray, s) <> -1 Then
236InBlock.gif            tmpda = DACols(s)
237InBlock.gif            tmpda.Update(Me.DsAllTables)
238InBlock.gif
239InBlock.gif            ' End If
240InBlock.gif        Next
241InBlock.gif
242ExpandedSubBlockEnd.gif    End Sub

243ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Sub Update()Sub Update(ByVal tbName As String)
244InBlock.gif        Dim tmpda As IDataAdapter
245InBlock.gif
246InBlock.gif        'If Array.IndexOf(Me.ConstArray, s) <> -1 Then
247InBlock.gif        tmpda = DACols(tbName)
248InBlock.gif        tmpda.Update(Me.DsAllTables)
249InBlock.gif
250InBlock.gif        ' End If
251InBlock.gif
252InBlock.gif
253ExpandedSubBlockEnd.gif    End Sub

254InBlock.gif
255InBlock.gif
256InBlock.gif
257InBlock.gif
258ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Property DataAdepterList()Property DataAdepterList() As System.Collections.SortedList
259InBlock.gif
260InBlock.gif        Get
261InBlock.gif            Return Me.DACols
262InBlock.gif        End Get
263InBlock.gif        Set(ByVal value As System.Collections.SortedList)
264InBlock.gif            Me.DACols = value
265InBlock.gif        End Set
266ExpandedSubBlockEnd.gif    End Property

267InBlock.gif
268InBlock.gif
269InBlock.gif
270ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Property ConstValues()Property ConstValues(ByVal TableName As StringByVal ConstName As StringOptional ByVal Field As String = "Value"Optional ByVal Do_UPDATE As Boolean = FalseAs Object
271InBlock.gif
272InBlock.gif        Get
273InBlock.gif
274InBlock.gif
275InBlock.gif            Dim table As DataTable = Me.BaseDataSet.Tables(TableName)
276InBlock.gif            Dim rs() As DataRow
277InBlock.gif            rs = (table.Select("Name='" & ConstName & "'"))
278InBlock.gif            If rs.Length = 0 Then
279InBlock.gif                Throw New Exception("本常量表没有此常量")
280InBlock.gif            Else
281InBlock.gif                Dim r As DataRow = rs(0)
282InBlock.gif
283InBlock.gif                Return r(Field)
284InBlock.gif
285InBlock.gif
286InBlock.gif            End If
287InBlock.gif
288InBlock.gif
289InBlock.gif        End Get
290InBlock.gif        Set(ByVal Value As Object)
291InBlock.gif
292InBlock.gif            Dim table As DataTable = Me.ConstTables(TableName)
293InBlock.gif            Dim rs() As DataRow
294InBlock.gif            rs = (table.Select("Name='" & ConstName & "'"))
295InBlock.gif            If rs.Length = 0 Then
296InBlock.gif                Throw New Exception("本常量表没有此常量")
297InBlock.gif            Else
298InBlock.gif                Dim r As DataRow = rs(0)
299InBlock.gif                r(Field) = Value
300InBlock.gif                If Do_UPDATE Then Me.UpdateSingleRow(r)
301InBlock.gif
302InBlock.gif
303InBlock.gif            End If
304InBlock.gif
305InBlock.gif        End Set
306ExpandedSubBlockEnd.gif    End Property

307InBlock.gif
308InBlock.gif
309InBlock.gif
310InBlock.gif
311InBlock.gif
312InBlock.gif
313ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Property ConstValues()Property ConstValues(ByVal TableName As StringByVal ConstID As LongOptional ByVal Field As String = "Value"Optional ByVal Do_UPDATE As Boolean = FalseAs Object
314InBlock.gif
315InBlock.gif        Get
316InBlock.gif
317InBlock.gif
318InBlock.gif            Dim table As DataTable = Me.BaseDataSet.Tables(TableName)
319InBlock.gif            Dim rs() As DataRow
320InBlock.gif            rs = (table.Select("ID=" & ConstID & ""))
321InBlock.gif            If rs.Length = 0 Then
322InBlock.gif                Throw New Exception("本常量表没有此常量")
323InBlock.gif            Else
324InBlock.gif                Try
325InBlock.gif                    Dim r As DataRow = rs(0)
326InBlock.gif
327InBlock.gif                    Return r(Field)
328InBlock.gif                Catch e As Exception
329InBlock.gif                    Return Nothing
330InBlock.gif                End Try
331InBlock.gif
332InBlock.gif
333InBlock.gif            End If
334InBlock.gif
335InBlock.gif
336InBlock.gif        End Get
337InBlock.gif        Set(ByVal Value As Object)
338InBlock.gif
339InBlock.gif            Dim table As DataTable = Me.ConstTables(TableName)
340InBlock.gif            Dim rs() As DataRow
341InBlock.gif            rs = (table.Select("ID='" & ConstID & "'"))
342InBlock.gif            If rs.Length = 0 Then
343InBlock.gif                Throw New Exception("本常量表没有此常量")
344InBlock.gif            Else
345InBlock.gif                Dim r As DataRow = rs(0)
346InBlock.gif                r(Field) = Value
347InBlock.gif                If Do_UPDATE Then Me.UpdateSingleRow(r)
348InBlock.gif
349InBlock.gif
350InBlock.gif            End If
351InBlock.gif
352InBlock.gif        End Set
353ExpandedSubBlockEnd.gif    End Property

354InBlock.gif
355InBlock.gif
356InBlock.gif
357InBlock.gif
358InBlock.gif
359ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Function UpdateSingleRow()Function UpdateSingleRow(ByVal row As DataRow) As DataRow
360InBlock.gif
361InBlock.gif        Dim r(0As DataRow
362InBlock.gif        r(0= row
363InBlock.gif        Dim s() As String = Me.DataAdepterList(row.Table.TableName).GetType.ToString.Split(".")
364InBlock.gif
365InBlock.gif        Select Case s(s.Length - 1)
366InBlock.gif            Case "SqlDataAdapter"
367InBlock.gif
368InBlock.gif                CType(Me.DataAdepterList(row.Table.TableName), SqlDataAdapter).Update(r)
369InBlock.gif
370InBlock.gif            Case "OleDbDataAdapter"
371InBlock.gif                CType(Me.DataAdepterList(row.Table.TableName), OleDbDataAdapter).Update(r)
372InBlock.gif
373InBlock.gif            Case "OdbcDataAdapter"
374InBlock.gif                CType(Me.DataAdepterList(row.Table.TableName), OdbcDataAdapter).Update(r)
375InBlock.gif
376InBlock.gif            Case "OracleDataAdapter"
377InBlock.gif                CType(Me.DataAdepterList(row.Table.TableName), OracleDataAdapter).Update(r)
378InBlock.gif
379InBlock.gif        End Select
380InBlock.gif
381InBlock.gif
382InBlock.gif
383InBlock.gif        Return r(0)
384InBlock.gif
385ExpandedSubBlockEnd.gif    End Function

386InBlock.gif
387InBlock.gif
388ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Function UpdateRows()Function UpdateRows(ByVal rows As DataRow()) As DataRow()
389InBlock.gif        Dim s() As String = Me.DataAdepterList(rows(0).Table.TableName).GetType.ToString.Split(".")
390InBlock.gif
391InBlock.gif        Select Case s(s.Length - 1)
392InBlock.gif            Case "SqlDataAdapter"
393InBlock.gif                CType(Me.DataAdepterList(rows(0).Table.TableName), SqlDataAdapter).Update(rows)
394InBlock.gif
395InBlock.gif
396InBlock.gif            Case "OleDbDataAdapter"
397InBlock.gif                CType(Me.DataAdepterList(rows(0).Table.TableName), OleDbDataAdapter).Update(rows)
398InBlock.gif
399InBlock.gif
400InBlock.gif            Case "OdbcDataAdapter"
401InBlock.gif                CType(Me.DataAdepterList(rows(0).Table.TableName), OdbcDataAdapter).Update(rows)
402InBlock.gif
403InBlock.gif
404InBlock.gif            Case "OracleDataAdapter"
405InBlock.gif                CType(Me.DataAdepterList(rows(0).Table.TableName), OdbcDataAdapter).Update(rows)
406InBlock.gif
407InBlock.gif        End Select
408InBlock.gif        Return rows
409InBlock.gif
410InBlock.gif
411InBlock.gif
412InBlock.gif
413ExpandedSubBlockEnd.gif    End Function

414InBlock.gif
415ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Overridable Function BeginTransaction()Function BeginTransaction() As IDbTransaction
416InBlock.gif
417InBlock.gif        Dim t As Data.IDbTransaction = Me.DBConnection.BeginTransaction()
418InBlock.gif
419InBlock.gif        For Each dao As Object In Me.DataAdepterList.Values
420InBlock.gif            Dim s() As String = dao.GetType.ToString.Split(".")
421InBlock.gif
422InBlock.gif            Select Case s(s.Length - 1)
423InBlock.gif                Case "SqlDataAdapter"
424InBlock.gif                    Dim da As SqlDataAdapter = dao
425InBlock.gif                    If Not da.InsertCommand Is Nothing Then da.InsertCommand.Transaction = t
426InBlock.gif                    If Not da.DeleteCommand Is Nothing Then da.DeleteCommand.Transaction = t
427InBlock.gif                    If Not da.UpdateCommand Is Nothing Then da.UpdateCommand.Transaction = t
428InBlock.gif                    If Not da.SelectCommand Is Nothing Then da.SelectCommand.Transaction = t
429InBlock.gif
430InBlock.gif                Case "OleDbDataAdapter"
431InBlock.gif                    Dim da As OleDbDataAdapter = dao
432InBlock.gif                    If Not da.InsertCommand Is Nothing Then da.InsertCommand.Transaction = t
433InBlock.gif                    If Not da.DeleteCommand Is Nothing Then da.DeleteCommand.Transaction = t
434InBlock.gif                    If Not da.UpdateCommand Is Nothing Then da.UpdateCommand.Transaction = t
435InBlock.gif                    If Not da.SelectCommand Is Nothing Then da.SelectCommand.Transaction = t
436InBlock.gif
437InBlock.gif                Case "OdbcDataAdapter"
438InBlock.gif
439InBlock.gif                    Dim da As OdbcDataAdapter = dao
440InBlock.gif                    If Not da.InsertCommand Is Nothing Then da.InsertCommand.Transaction = t
441InBlock.gif                    If Not da.DeleteCommand Is Nothing Then da.DeleteCommand.Transaction = t
442InBlock.gif                    If Not da.UpdateCommand Is Nothing Then da.UpdateCommand.Transaction = t
443InBlock.gif                    If Not da.SelectCommand Is Nothing Then da.SelectCommand.Transaction = t
444InBlock.gif
445InBlock.gif                Case "OracleDataAdapter"
446InBlock.gif                    Dim da As OracleDataAdapter = dao
447InBlock.gif                    If Not da.InsertCommand Is Nothing Then da.InsertCommand.Transaction = t
448InBlock.gif                    If Not da.DeleteCommand Is Nothing Then da.DeleteCommand.Transaction = t
449InBlock.gif                    If Not da.UpdateCommand Is Nothing Then da.UpdateCommand.Transaction = t
450InBlock.gif                    If Not da.SelectCommand Is Nothing Then da.SelectCommand.Transaction = t
451InBlock.gif            End Select
452InBlock.gif
453InBlock.gif
454InBlock.gif
455InBlock.gif        Next
456InBlock.gif        Return t
457ExpandedSubBlockEnd.gif    End Function

458InBlock.gif
459InBlock.gif
460InBlock.gif
461ExpandedSubBlockStart.gifContractedSubBlock.gif    Public Function XmlText()Function XmlText() As String
462InBlock.gif        Dim sw As System.IO.StringWriter = New System.IO.StringWriter
463InBlock.gif        BaseDataSet.WriteXml(sw)
464InBlock.gif
465InBlock.gif        Return sw.ToString
466ExpandedSubBlockEnd.gif    End Function

467InBlock.gif
468InBlock.gif
469ExpandedSubBlockEnd.gif#End Region

470InBlock.gif
471InBlock.gif
472InBlock.gif
473InBlock.gif
474InBlock.gif
475InBlock.gif
476ExpandedBlockEnd.gifEnd Class

477None.gif
478None.gif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值