📄 productsresultset.designer.vb
字号:
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.312
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports System
Imports System.Data
Partial Public Class ProductResultSet
Inherits System.Data.SqlServerCe.SqlCeResultSet
Private resultSetConnectionString As String = Nothing
Private sqlCeConnection As System.Data.SqlServerCe.SqlCeConnection = Nothing
Private resultSetOptions As System.Data.SqlServerCe.ResultSetOptions
Public Sub New()
MyBase.New
'Create default options
'
resultSetOptions = System.Data.SqlServerCe.ResultSetOptions.Scrollable
resultSetOptions = (resultSetOptions Or System.Data.SqlServerCe.ResultSetOptions.Sensitive)
resultSetOptions = (resultSetOptions Or System.Data.SqlServerCe.ResultSetOptions.Updatable)
'To enable design time support, the resultSetConnectionString property needs to switched between a Designtime and Runtime connection string.
'The design time connection string is used to make a valid connection to the database and retrieve schema information.
'
If ProductsResultSetUtil.DesignerUtil.IsDesignTime Then
'Designtime Connection String
resultSetConnectionString = "Data Source =""C:\Users\Andy\Documents\Compact Framework Book V2.0\Sample Code\Cha"& _
"pter 3\VB\SqlCeDataSetsAndSqlCqResultSets\SqlCeDataSetsAndSqlCqResultSets\MyData"& _
"base.sdf""; Password =""MobileP@ssw0rd"";"
Else
'Runtime Connection String
resultSetConnectionString = ("Data Source =" _
+ (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase) _
+ ("\MyDatabase.sdf;" _
+ ("Password =" + """MobileP@ssw0rd"";"))))
End If
'Call Open() to initialize the ResultSet
'
Me.Open
End Sub
Public Sub New(ByVal connectionString As String, ByVal options As System.Data.SqlServerCe.ResultSetOptions)
MyBase.New
resultSetConnectionString = connectionString
resultSetOptions = options
Me.Open
End Sub
Public ReadOnly Property Connection() As System.Data.SqlServerCe.SqlCeConnection
Get
Return sqlCeConnection
End Get
End Property
Public Property ProductID() As Integer
Get
Return CType(MyBase.GetInt32(MyBase.GetOrdinal("ProductID")),Integer)
End Get
Set
MyBase.SetInt32(MyBase.GetOrdinal("ProductID"), value)
End Set
End Property
Public Property Name() As String
Get
Return CType(MyBase.GetString(MyBase.GetOrdinal("Name")),String)
End Get
Set
MyBase.SetString(MyBase.GetOrdinal("Name"), value)
End Set
End Property
Public Property Color() As String
Get
Try
Return CType(MyBase.GetString(MyBase.GetOrdinal("Color")),String)
Catch e As System.InvalidCastException
Throw New System.Data.StrongTypingException("StrongTyping_CananotAccessDBNull", e)
End Try
End Get
Set
MyBase.SetString(MyBase.GetOrdinal("Color"), value)
End Set
End Property
Public Property ListPrice() As Decimal
Get
Return CType(MyBase.GetDecimal(MyBase.GetOrdinal("ListPrice")),Decimal)
End Get
Set
MyBase.SetDecimal(MyBase.GetOrdinal("ListPrice"), value)
End Set
End Property
Public Property Size() As String
Get
Try
Return CType(MyBase.GetString(MyBase.GetOrdinal("Size")),String)
Catch e As System.InvalidCastException
Throw New System.Data.StrongTypingException("StrongTyping_CananotAccessDBNull", e)
End Try
End Get
Set
MyBase.SetString(MyBase.GetOrdinal("Size"), value)
End Set
End Property
Public Property ProductCategoryID() As Integer
Get
Return CType(MyBase.GetInt32(MyBase.GetOrdinal("ProductCategoryID")),Integer)
End Get
Set
MyBase.SetInt32(MyBase.GetOrdinal("ProductCategoryID"), value)
End Set
End Property
Public Sub Open()
Dim sqlCeSelectCommand As System.Data.SqlServerCe.SqlCeCommand
'Open a connection to the database
'
sqlCeConnection = New System.Data.SqlServerCe.SqlCeConnection(Me.resultSetConnectionString)
sqlCeConnection.Open
'Create the command
'
sqlCeSelectCommand = sqlCeConnection.CreateCommand
sqlCeSelectCommand.CommandText = "Product"
sqlCeSelectCommand.CommandType = System.Data.CommandType.TableDirect
'Generate the ResultSet
'
sqlCeSelectCommand.ExecuteResultSet(Me.resultSetOptions, Me)
End Sub
Public Sub MoveToRow(ByVal Row As Integer)
MyBase.ReadAbsolute(Row)
End Sub
Public Sub DeleteRecord()
MyBase.Delete
End Sub
Public Function IsColorNull() As Boolean
Return MyBase.IsDBNull(MyBase.GetOrdinal("Color"))
End Function
Public Sub SetColorNull()
MyBase.SetValue(MyBase.GetOrdinal("Color"), System.DBNull.Value)
End Sub
Public Function IsSizeNull() As Boolean
Return MyBase.IsDBNull(MyBase.GetOrdinal("Size"))
End Function
Public Sub SetSizeNull()
MyBase.SetValue(MyBase.GetOrdinal("Size"), System.DBNull.Value)
End Sub
Public Sub AddProductRecord(ByVal Name As String, ByVal Color As String, ByVal ListPrice As Decimal, ByVal Size As String, ByVal ProductCategoryID As Integer)
Dim newRecord As System.Data.SqlServerCe.SqlCeUpdatableRecord = MyBase.CreateRecord
newRecord("Name") = Name
newRecord("Color") = Color
newRecord("ListPrice") = ListPrice
newRecord("Size") = Size
newRecord("ProductCategoryID") = ProductCategoryID
MyBase.Insert(newRecord)
End Sub
Public Sub Bind(ByVal bindingSource As System.Windows.Forms.BindingSource)
bindingSource.DataSource = Me.ResultSetView
End Sub
End Class
Partial Public Class ProductCategoryResultSet
Inherits System.Data.SqlServerCe.SqlCeResultSet
Private resultSetConnectionString As String = Nothing
Private sqlCeConnection As System.Data.SqlServerCe.SqlCeConnection = Nothing
Private resultSetOptions As System.Data.SqlServerCe.ResultSetOptions
Public Sub New()
MyBase.New
'Create default options
'
resultSetOptions = System.Data.SqlServerCe.ResultSetOptions.Scrollable
resultSetOptions = (resultSetOptions Or System.Data.SqlServerCe.ResultSetOptions.Sensitive)
resultSetOptions = (resultSetOptions Or System.Data.SqlServerCe.ResultSetOptions.Updatable)
'To enable design time support, the resultSetConnectionString property needs to switched between a Designtime and Runtime connection string.
'The design time connection string is used to make a valid connection to the database and retrieve schema information.
'
If ProductsResultSetUtil.DesignerUtil.IsDesignTime Then
'Designtime Connection String
resultSetConnectionString = "Data Source =""C:\Users\Andy\Documents\Compact Framework Book V2.0\Sample Code\Cha"& _
"pter 3\VB\SqlCeDataSetsAndSqlCqResultSets\SqlCeDataSetsAndSqlCqResultSets\MyData"& _
"base.sdf""; Password =""MobileP@ssw0rd"";"
Else
'Runtime Connection String
resultSetConnectionString = ("Data Source =" _
+ (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase) _
+ ("\MyDatabase.sdf;" _
+ ("Password =" + """MobileP@ssw0rd"";"))))
End If
'Call Open() to initialize the ResultSet
'
Me.Open
End Sub
Public Sub New(ByVal connectionString As String, ByVal options As System.Data.SqlServerCe.ResultSetOptions)
MyBase.New
resultSetConnectionString = connectionString
resultSetOptions = options
Me.Open
End Sub
Public ReadOnly Property Connection() As System.Data.SqlServerCe.SqlCeConnection
Get
Return sqlCeConnection
End Get
End Property
Public Property ProductCategoryID() As Integer
Get
Return CType(MyBase.GetInt32(MyBase.GetOrdinal("ProductCategoryID")),Integer)
End Get
Set
MyBase.SetInt32(MyBase.GetOrdinal("ProductCategoryID"), value)
End Set
End Property
Public Property Name() As String
Get
Return CType(MyBase.GetString(MyBase.GetOrdinal("Name")),String)
End Get
Set
MyBase.SetString(MyBase.GetOrdinal("Name"), value)
End Set
End Property
Public Sub Open()
Dim sqlCeSelectCommand As System.Data.SqlServerCe.SqlCeCommand
'Open a connection to the database
'
sqlCeConnection = New System.Data.SqlServerCe.SqlCeConnection(Me.resultSetConnectionString)
sqlCeConnection.Open
'Create the command
'
sqlCeSelectCommand = sqlCeConnection.CreateCommand
sqlCeSelectCommand.CommandText = "ProductCategory"
sqlCeSelectCommand.CommandType = System.Data.CommandType.TableDirect
'Generate the ResultSet
'
sqlCeSelectCommand.ExecuteResultSet(Me.resultSetOptions, Me)
End Sub
Public Sub MoveToRow(ByVal Row As Integer)
MyBase.ReadAbsolute(Row)
End Sub
Public Sub DeleteRecord()
MyBase.Delete
End Sub
Public Sub AddProductCategoryRecord(ByVal Name As String)
Dim newRecord As System.Data.SqlServerCe.SqlCeUpdatableRecord = MyBase.CreateRecord
newRecord("Name") = Name
MyBase.Insert(newRecord)
End Sub
Public Sub Bind(ByVal bindingSource As System.Windows.Forms.BindingSource)
bindingSource.DataSource = Me.ResultSetView
End Sub
End Class
Namespace ProductsResultSetUtil
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 + -