📄 appdatabasedataset.designer.vb
字号:
Return Me._connection
End Get
Set
Me._connection = value
If (Not (Me.Adapter.InsertCommand) Is Nothing) Then
Me.Adapter.InsertCommand.Connection = value
End If
If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then
Me.Adapter.DeleteCommand.Connection = value
End If
If (Not (Me.Adapter.UpdateCommand) Is Nothing) Then
Me.Adapter.UpdateCommand.Connection = value
End If
Dim i As Integer = 0
Do While (i < Me.CommandCollection.Length)
If (Not (Me.CommandCollection(i)) Is Nothing) Then
CType(Me.CommandCollection(i),System.Data.SqlServerCe.SqlCeCommand).Connection = value
End If
i = (i + 1)
Loop
End Set
End Property
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected ReadOnly Property CommandCollection() As System.Data.SqlServerCe.SqlCeCommand()
Get
If (Me._commandCollection Is Nothing) Then
Me.InitCommandCollection
End If
Return Me._commandCollection
End Get
End Property
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property ClearBeforeFill() As Boolean
Get
Return Me._clearBeforeFill
End Get
Set
Me._clearBeforeFill = value
End Set
End Property
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitAdapter()
Me._adapter = New System.Data.SqlServerCe.SqlCeDataAdapter
Dim tableMapping As System.Data.Common.DataTableMapping = New System.Data.Common.DataTableMapping
tableMapping.SourceTable = "Table"
tableMapping.DataSetTable = "Products"
tableMapping.ColumnMappings.Add("ProductId", "ProductId")
tableMapping.ColumnMappings.Add("ProductName", "ProductName")
tableMapping.ColumnMappings.Add("Price", "Price")
tableMapping.ColumnMappings.Add("Description", "Description")
Me._adapter.TableMappings.Add(tableMapping)
Me._adapter.DeleteCommand = New System.Data.SqlServerCe.SqlCeCommand
Me._adapter.DeleteCommand.Connection = Me.Connection
Me._adapter.DeleteCommand.CommandText = "DELETE FROM [Products] WHERE (([ProductId] = @p1))"
Me._adapter.DeleteCommand.CommandType = System.Data.CommandType.Text
Dim param As System.Data.SqlServerCe.SqlCeParameter = New System.Data.SqlServerCe.SqlCeParameter
param.ParameterName = "@p1"
param.DbType = System.Data.DbType.Int32
param.IsNullable = true
param.SourceColumn = "ProductId"
param.SourceVersion = System.Data.DataRowVersion.Original
Me._adapter.DeleteCommand.Parameters.Add(param)
Me._adapter.InsertCommand = New System.Data.SqlServerCe.SqlCeCommand
Me._adapter.InsertCommand.Connection = Me.Connection
Me._adapter.InsertCommand.CommandText = "INSERT INTO [Products] ([ProductName], [Price], [Description]) VALUES (@p1, @p2, "& _
"@p3)"
Me._adapter.InsertCommand.CommandType = System.Data.CommandType.Text
param = New System.Data.SqlServerCe.SqlCeParameter
param.ParameterName = "@p1"
param.IsNullable = true
param.SourceColumn = "ProductName"
Me._adapter.InsertCommand.Parameters.Add(param)
param = New System.Data.SqlServerCe.SqlCeParameter
param.ParameterName = "@p2"
param.DbType = System.Data.DbType.Currency
param.IsNullable = true
param.SourceColumn = "Price"
Me._adapter.InsertCommand.Parameters.Add(param)
param = New System.Data.SqlServerCe.SqlCeParameter
param.ParameterName = "@p3"
param.IsNullable = true
param.SourceColumn = "Description"
Me._adapter.InsertCommand.Parameters.Add(param)
Me._adapter.UpdateCommand = New System.Data.SqlServerCe.SqlCeCommand
Me._adapter.UpdateCommand.Connection = Me.Connection
Me._adapter.UpdateCommand.CommandText = "UPDATE [Products] SET [ProductName] = @p1, [Price] = @p2, [Description] = @p3 WHE"& _
"RE (([ProductId] = @p4))"
Me._adapter.UpdateCommand.CommandType = System.Data.CommandType.Text
param = New System.Data.SqlServerCe.SqlCeParameter
param.ParameterName = "@p1"
param.IsNullable = true
param.SourceColumn = "ProductName"
Me._adapter.UpdateCommand.Parameters.Add(param)
param = New System.Data.SqlServerCe.SqlCeParameter
param.ParameterName = "@p2"
param.DbType = System.Data.DbType.Currency
param.IsNullable = true
param.SourceColumn = "Price"
Me._adapter.UpdateCommand.Parameters.Add(param)
param = New System.Data.SqlServerCe.SqlCeParameter
param.ParameterName = "@p3"
param.IsNullable = true
param.SourceColumn = "Description"
Me._adapter.UpdateCommand.Parameters.Add(param)
param = New System.Data.SqlServerCe.SqlCeParameter
param.ParameterName = "@p4"
param.DbType = System.Data.DbType.Int32
param.IsNullable = true
param.SourceColumn = "ProductId"
param.SourceVersion = System.Data.DataRowVersion.Original
Me._adapter.UpdateCommand.Parameters.Add(param)
End Sub
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitConnection()
Me._connection = New System.Data.SqlServerCe.SqlCeConnection
Me._connection.ConnectionString = ("Data Source =" _
+ (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase) + "\AppDatabase.sdf;"))
End Sub
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitCommandCollection()
Me._commandCollection = New System.Data.SqlServerCe.SqlCeCommand(0) {}
Me._commandCollection(0) = New System.Data.SqlServerCe.SqlCeCommand
Me._commandCollection(0).Connection = Me.Connection
Me._commandCollection(0).CommandText = "SELECT [ProductId], [ProductName], [Price], [Description] FROM [Products]"
Me._commandCollection(0).CommandType = System.Data.CommandType.Text
End Sub
<System.Diagnostics.DebuggerNonUserCodeAttribute(), _
System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, true)> _
Public Overloads Overridable Function Fill(ByVal dataTable As AppDatabaseDataSet.ProductsDataTable) As Integer
Me.Adapter.SelectCommand = Me.CommandCollection(0)
If (Me.ClearBeforeFill = true) Then
dataTable.Clear
End If
Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
Return returnValue
End Function
<System.Diagnostics.DebuggerNonUserCodeAttribute(), _
System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.[Select], true)> _
Public Overloads Overridable Function GetData() As AppDatabaseDataSet.ProductsDataTable
Me.Adapter.SelectCommand = Me.CommandCollection(0)
Dim dataTable As AppDatabaseDataSet.ProductsDataTable = New AppDatabaseDataSet.ProductsDataTable
Me.Adapter.Fill(dataTable)
Return dataTable
End Function
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overloads Overridable Function Update(ByVal dataTable As AppDatabaseDataSet.ProductsDataTable) As Integer
Return Me.Adapter.Update(dataTable)
End Function
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overloads Overridable Function Update(ByVal dataSet As AppDatabaseDataSet) As Integer
Return Me.Adapter.Update(dataSet, "Products")
End Function
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overloads Overridable Function Update(ByVal dataRow As System.Data.DataRow) As Integer
Return Me.Adapter.Update(New System.Data.DataRow() {dataRow})
End Function
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overloads Overridable Function Update(ByVal dataRows() As System.Data.DataRow) As Integer
Return Me.Adapter.Update(dataRows)
End Function
<System.Diagnostics.DebuggerNonUserCodeAttribute(), _
System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)> _
Public Overloads Overridable Function Delete(ByVal p1 As Integer) As Integer
Me.Adapter.DeleteCommand.Parameters(0).Value = CType(p1,Integer)
Dim previousConnectionState As System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
If ((Me.Adapter.DeleteCommand.Connection.State And System.Data.ConnectionState.Open) _
<> System.Data.ConnectionState.Open) Then
Me.Adapter.DeleteCommand.Connection.Open
End If
Try
Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
Return returnValue
Finally
If (previousConnectionState = System.Data.ConnectionState.Closed) Then
Me.Adapter.DeleteCommand.Connection.Close
End If
End Try
End Function
<System.Diagnostics.DebuggerNonUserCodeAttribute(), _
System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)> _
Public Overloads Overridable Function Insert(ByVal p1 As String, ByVal p2 As Decimal, ByVal p3 As String) As Integer
If (p1 Is Nothing) Then
Throw New System.ArgumentNullException("p1")
Else
Me.Adapter.InsertCommand.Parameters(0).Value = CType(p1,String)
End If
Me.Adapter.InsertCommand.Parameters(1).Value = CType(p2,Decimal)
If (p3 Is Nothing) Then
Me.Adapter.InsertCommand.Parameters(2).Value = System.DBNull.Value
Else
Me.Adapter.InsertCommand.Parameters(2).Value = CType(p3,String)
End If
Dim previousConnectionState As System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State
If ((Me.Adapter.InsertCommand.Connection.State And System.Data.ConnectionState.Open) _
<> System.Data.ConnectionState.Open) Then
Me.Adapter.InsertCommand.Connection.Open
End If
Try
Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery
Return returnValue
Finally
If (previousConnectionState = System.Data.ConnectionState.Closed) Then
Me.Adapter.InsertCommand.Connection.Close
End If
End Try
End Function
<System.Diagnostics.DebuggerNonUserCodeAttribute(), _
System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)> _
Public Overloads Overridable Function Update(ByVal p1 As String, ByVal p2 As Decimal, ByVal p3 As String, ByVal p4 As Integer) As Integer
If (p1 Is Nothing) Then
Throw New System.ArgumentNullException("p1")
Else
Me.Adapter.UpdateCommand.Parameters(0).Value = CType(p1,String)
End If
Me.Adapter.UpdateCommand.Parameters(1).Value = CType(p2,Decimal)
If (p3 Is Nothing) Then
Me.Adapter.UpdateCommand.Parameters(2).Value = System.DBNull.Value
Else
Me.Adapter.UpdateCommand.Parameters(2).Value = CType(p3,String)
End If
Me.Adapter.UpdateCommand.Parameters(3).Value = CType(p4,Integer)
Dim previousConnectionState As System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
If ((Me.Adapter.UpdateCommand.Connection.State And System.Data.ConnectionState.Open) _
<> System.Data.ConnectionState.Open) Then
Me.Adapter.UpdateCommand.Connection.Open
End If
Try
Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
Return returnValue
Finally
If (previousConnectionState = System.Data.ConnectionState.Closed) Then
Me.Adapter.UpdateCommand.Connection.Close
End If
End Try
End Function
End Class
End Namespace
Namespace AppDatabaseDataSetUtil
Partial Public Class DesignerUtil
Public Shared Function IsDesignTime() As Boolean
'Determine if this instance is running against .NET Framework by using the MSCoreLib PublicKeyToken
Dim mscorlibAssembly As System.Reflection.[Assembly] = GetType(Integer).Assembly
If (Not (mscorlibAssembly) Is Nothing) Then
If mscorlibAssembly.FullName.ToUpper.EndsWith("B77A5C561934E089") Then
Return true
End If
End If
Return false
End Function
Public Shared Function IsRunTime() As Boolean
'Determine if this instance is running against .NET Compact Framework by using the MSCoreLib PublicKeyToken
Dim mscorlibAssembly As System.Reflection.[Assembly] = GetType(Integer).Assembly
If (Not (mscorlibAssembly) Is Nothing) Then
If mscorlibAssembly.FullName.ToUpper.EndsWith("969DB8053D3322AC") Then
Return true
End If
End If
Return false
End Function
End Class
End Namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -