当前位置: 首页 > news >正文

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

转载于:https://www.cnblogs.com/waynebaby/archive/2006/01/12/316171.html

相关文章:

  • Scrum实施日记 - 我可以问问题吗?
  • Design Patterns
  • 手机端雅安地震寻人整合项目
  • 香港身份证
  • UDDI(一)
  • 浅谈 XSS CSRF(转)
  • ansible笔记(2):管理清单配置详解
  • VS2015 Web应用程序发布
  • 《Java核心技术卷一》之 泛型
  • emacs 窗口控制
  • 如何在同一任务列表中显示我的任务及我所属组的任务
  • POJ2017-Speed Limit
  • springboot不占用端口启动
  • C语言标准中的逻辑位移和算术位移
  • 本体感受和演讲能力
  • 【Amaple教程】5. 插件
  • 【干货分享】SpringCloud微服务架构分布式组件如何共享session对象
  • 【挥舞JS】JS实现继承,封装一个extends方法
  • 【译】React性能工程(下) -- 深入研究React性能调试
  • Android 架构优化~MVP 架构改造
  • CNN 在图像分割中的简史:从 R-CNN 到 Mask R-CNN
  • codis proxy处理流程
  • echarts花样作死的坑
  • EventListener原理
  • iOS小技巧之UIImagePickerController实现头像选择
  • Java-详解HashMap
  • Java知识点总结(JavaIO-打印流)
  • MyEclipse 8.0 GA 搭建 Struts2 + Spring2 + Hibernate3 (测试)
  • nginx(二):进阶配置介绍--rewrite用法,压缩,https虚拟主机等
  • Python_OOP
  • Python3爬取英雄联盟英雄皮肤大图
  • Python中eval与exec的使用及区别
  • use Google search engine
  • vagrant 添加本地 box 安装 laravel homestead
  • 半理解系列--Promise的进化史
  • 分布式任务队列Celery
  • 记一次用 NodeJs 实现模拟登录的思路
  • 开放才能进步!Angular和Wijmo一起走过的日子
  • 利用DataURL技术在网页上显示图片
  • 删除表内多余的重复数据
  • 小程序01:wepy框架整合iview webapp UI
  • 移动端 h5开发相关内容总结(三)
  • ## 临床数据 两两比较 加显著性boxplot加显著性
  • #FPGA(基础知识)
  • #经典论文 异质山坡的物理模型 2 有效导水率
  • ( )的作用是将计算机中的信息传送给用户,计算机应用基础 吉大15春学期《计算机应用基础》在线作业二及答案...
  • (2)关于RabbitMq 的 Topic Exchange 主题交换机
  • (超简单)使用vuepress搭建自己的博客并部署到github pages上
  • (附源码)springboot宠物管理系统 毕业设计 121654
  • (紀錄)[ASP.NET MVC][jQuery]-2 純手工打造屬於自己的 jQuery GridView (含完整程式碼下載)...
  • (解决办法)ASP.NET导出Excel,打开时提示“您尝试打开文件'XXX.xls'的格式与文件扩展名指定文件不一致
  • (三)Pytorch快速搭建卷积神经网络模型实现手写数字识别(代码+详细注解)
  • (转载)(官方)UE4--图像编程----着色器开发
  • .Net CF下精确的计时器
  • .net core IResultFilter 的 OnResultExecuted和OnResultExecuting的区别