📄 adventureworksdataset.designer.vb
字号:
tableMapping.ColumnMappings.Add("ThumbnailPhotoFileName", "ThumbnailPhotoFileName")
tableMapping.ColumnMappings.Add("LargePhoto", "LargePhoto")
tableMapping.ColumnMappings.Add("LargePhotoFileName", "LargePhotoFileName")
tableMapping.ColumnMappings.Add("ModifiedDate", "ModifiedDate")
Me.m_adapter.TableMappings.Add(tableMapping)
Me.m_adapter.DeleteCommand = New System.Data.SqlClient.SqlCommand
Me.m_adapter.DeleteCommand.Connection = Me.Connection
Me.m_adapter.DeleteCommand.CommandText = "DELETE FROM [Production].[ProductPhoto] WHERE (([ProductPhotoID] = @Original_Prod"& _
"uctPhotoID) AND ((@IsNull_ThumbnailPhotoFileName = 1 AND [ThumbnailPhotoFileName"& _
"] IS NULL) OR ([ThumbnailPhotoFileName] = @Original_ThumbnailPhotoFileName)) AND"& _
" ((@IsNull_LargePhotoFileName = 1 AND [LargePhotoFileName] IS NULL) OR ([LargePh"& _
"otoFileName] = @Original_LargePhotoFileName)) AND ([ModifiedDate] = @Original_Mo"& _
"difiedDate))"
Me.m_adapter.DeleteCommand.CommandType = System.Data.CommandType.Text
Me.m_adapter.DeleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_ProductPhotoID", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "ProductPhotoID", System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me.m_adapter.DeleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@IsNull_ThumbnailPhotoFileName", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "ThumbnailPhotoFileName", System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me.m_adapter.DeleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_ThumbnailPhotoFileName", System.Data.SqlDbType.NVarChar, 0, System.Data.ParameterDirection.Input, 0, 0, "ThumbnailPhotoFileName", System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me.m_adapter.DeleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@IsNull_LargePhotoFileName", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "LargePhotoFileName", System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me.m_adapter.DeleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_LargePhotoFileName", System.Data.SqlDbType.NVarChar, 0, System.Data.ParameterDirection.Input, 0, 0, "LargePhotoFileName", System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me.m_adapter.DeleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_ModifiedDate", System.Data.SqlDbType.DateTime, 0, System.Data.ParameterDirection.Input, 0, 0, "ModifiedDate", System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me.m_adapter.InsertCommand = New System.Data.SqlClient.SqlCommand
Me.m_adapter.InsertCommand.Connection = Me.Connection
Me.m_adapter.InsertCommand.CommandText = "INSERT INTO [Production].[ProductPhoto] ([ThumbNailPhoto], [ThumbnailPhotoFileNam"& _
"e], [LargePhoto], [LargePhotoFileName], [ModifiedDate]) VALUES (@ThumbNailPhoto,"& _
" @ThumbnailPhotoFileName, @LargePhoto, @LargePhotoFileName, @ModifiedDate);"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SEL"& _
"ECT ProductPhotoID, ThumbNailPhoto, ThumbnailPhotoFileName, LargePhoto, LargePho"& _
"toFileName, ModifiedDate FROM Production.ProductPhoto WHERE (ProductPhotoID = @@"& _
"IDENTITY)"
Me.m_adapter.InsertCommand.CommandType = System.Data.CommandType.Text
Me.m_adapter.InsertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ThumbNailPhoto", System.Data.SqlDbType.VarBinary, 0, System.Data.ParameterDirection.Input, 0, 0, "ThumbNailPhoto", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.InsertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ThumbnailPhotoFileName", System.Data.SqlDbType.NVarChar, 0, System.Data.ParameterDirection.Input, 0, 0, "ThumbnailPhotoFileName", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.InsertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@LargePhoto", System.Data.SqlDbType.VarBinary, 0, System.Data.ParameterDirection.Input, 0, 0, "LargePhoto", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.InsertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@LargePhotoFileName", System.Data.SqlDbType.NVarChar, 0, System.Data.ParameterDirection.Input, 0, 0, "LargePhotoFileName", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.InsertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ModifiedDate", System.Data.SqlDbType.DateTime, 0, System.Data.ParameterDirection.Input, 0, 0, "ModifiedDate", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand = New System.Data.SqlClient.SqlCommand
Me.m_adapter.UpdateCommand.Connection = Me.Connection
Me.m_adapter.UpdateCommand.CommandText = "UPDATE [Production].[ProductPhoto] SET [ThumbNailPhoto] = @ThumbNailPhoto, [Thumb"& _
"nailPhotoFileName] = @ThumbnailPhotoFileName, [LargePhoto] = @LargePhoto, [Large"& _
"PhotoFileName] = @LargePhotoFileName, [ModifiedDate] = @ModifiedDate WHERE (([Pr"& _
"oductPhotoID] = @Original_ProductPhotoID) AND ((@IsNull_ThumbnailPhotoFileName ="& _
" 1 AND [ThumbnailPhotoFileName] IS NULL) OR ([ThumbnailPhotoFileName] = @Origina"& _
"l_ThumbnailPhotoFileName)) AND ((@IsNull_LargePhotoFileName = 1 AND [LargePhotoF"& _
"ileName] IS NULL) OR ([LargePhotoFileName] = @Original_LargePhotoFileName)) AND "& _
"([ModifiedDate] = @Original_ModifiedDate));"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT ProductPhotoID, ThumbNailPho"& _
"to, ThumbnailPhotoFileName, LargePhoto, LargePhotoFileName, ModifiedDate FROM Pr"& _
"oduction.ProductPhoto WHERE (ProductPhotoID = @ProductPhotoID)"
Me.m_adapter.UpdateCommand.CommandType = System.Data.CommandType.Text
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ThumbNailPhoto", System.Data.SqlDbType.VarBinary, 0, System.Data.ParameterDirection.Input, 0, 0, "ThumbNailPhoto", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ThumbnailPhotoFileName", System.Data.SqlDbType.NVarChar, 0, System.Data.ParameterDirection.Input, 0, 0, "ThumbnailPhotoFileName", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@LargePhoto", System.Data.SqlDbType.VarBinary, 0, System.Data.ParameterDirection.Input, 0, 0, "LargePhoto", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@LargePhotoFileName", System.Data.SqlDbType.NVarChar, 0, System.Data.ParameterDirection.Input, 0, 0, "LargePhotoFileName", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ModifiedDate", System.Data.SqlDbType.DateTime, 0, System.Data.ParameterDirection.Input, 0, 0, "ModifiedDate", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_ProductPhotoID", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "ProductPhotoID", System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@IsNull_ThumbnailPhotoFileName", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "ThumbnailPhotoFileName", System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_ThumbnailPhotoFileName", System.Data.SqlDbType.NVarChar, 0, System.Data.ParameterDirection.Input, 0, 0, "ThumbnailPhotoFileName", System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@IsNull_LargePhotoFileName", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "LargePhotoFileName", System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_LargePhotoFileName", System.Data.SqlDbType.NVarChar, 0, System.Data.ParameterDirection.Input, 0, 0, "LargePhotoFileName", System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_ModifiedDate", System.Data.SqlDbType.DateTime, 0, System.Data.ParameterDirection.Input, 0, 0, "ModifiedDate", System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me.m_adapter.UpdateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ProductPhotoID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, 0, 0, "ProductPhotoID", System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
End Sub
Private Sub InitConnection()
Me.m_connection = New System.Data.SqlClient.SqlConnection
Me.m_connection.ConnectionString = DataGridViewImagesAW.Settings.Default.AdventureWorksConnectionString
End Sub
Private Sub InitCommandCollection()
Me.m_commandCollection = New System.Data.SqlClient.SqlCommand(0) {}
Me.m_commandCollection(0) = New System.Data.SqlClient.SqlCommand
Me.m_commandCollection(0).Connection = Me.Connection
Me.m_commandCollection(0).CommandText = "SELECT ProductPhotoID, ThumbNailPhoto, ThumbnailPhotoFileName, LargePhoto, LargeP"& _
"hotoFileName, ModifiedDate FROM Production.ProductPhoto"
Me.m_commandCollection(0).CommandType = System.Data.CommandType.Text
End Sub
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, true)> _
Public Overloads Overridable Function Fill(ByVal dataTable As AdventureWorksDataSet.ProductPhotoDataTable) As Integer
Me.Adapter.SelectCommand = Me.CommandCollection(0)
If (Me.m_clearBeforeFill = true) Then
dataTable.Clear
End If
Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
Return returnValue
End Function
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.[Select], true)> _
Public Overloads Overridable Function GetData() As AdventureWorksDataSet.ProductPhotoDataTable
Me.Adapter.SelectCommand = Me.CommandCollection(0)
Dim dataTable As AdventureWorksDataSet.ProductPhotoDataTable = New AdventureWorksDataSet.ProductPhotoDataTable
Me.Adapter.Fill(dataTable)
Return dataTable
End Function
Public Overloads Overridable Function Update(ByVal dataTable As AdventureWorksDataSet.ProductPhotoDataTable) As Integer
Return Me.Adapter.Update(dataTable)
End Function
Public Overloads Overridable Function Update(ByVal dataSet As AdventureWorksDataSet) As Integer
Return Me.Adapter.Update(dataSet, "ProductPhoto")
End Function
Public Overloads Overridable Function Update(ByVal dataRow As System.Data.DataRow) As Integer
Return Me.Adapter.Update(New System.Data.DataRow() {dataRow})
End Function
Public Overloads Overridable Function Update(ByVal dataRows() As System.Data.DataRow) As Integer
Return Me.Adapter.Update(dataRows)
End Function
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)> _
Public Overloads Overridable Function Delete(ByVal Original_ProductPhotoID As Integer, ByVal Original_ThumbnailPhotoFileName As String, ByVal Original_LargePhotoFileName As String, ByVal Original_ModifiedDate As Date) As Integer
Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_ProductPhotoID,Integer)
If (Original_ThumbnailPhotoFileName Is Nothing) Then
Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Integer)
Me.Adapter.DeleteCommand.Parameters(2).Value = System.DBNull.Value
Else
Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Integer)
Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_ThumbnailPhotoFileName,String)
End If
If (Original_LargePhotoFileName Is Nothing) Then
Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Integer)
Me.Adapter.DeleteCommand.Parameters(4).Value = System.DBNull.Value
Else
Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Integer)
Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_LargePhotoFileName,String)
End If
Me.Adapter.DeleteCommand.Parameters(5).Value = CType(Original_ModifiedDate,Date)
Dim previousConnectionState As System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
Me.Adapter.DeleteCommand.Connection.Open
Try
Return Me.Adapter.DeleteCommand.ExecuteNonQuery
Finally
If (previousConnectionState = System.Data.ConnectionState.Closed) Then
Me.Adapter.DeleteCommand.Connection.Close
End If
End Try
End Function
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)> _
Public Overloads Overridable Function Insert(ByVal ThumbNailPhoto() As Byte, ByVal ThumbnailPhotoFileName As String, ByVal LargePhoto() As Byte, ByVal LargePhotoFileName As String, ByVal ModifiedDate As Date) As Integer
If (ThumbNailPhoto Is Nothing) Then
Me.Adapter.InsertCommand.Parameters(0).Value = System.DBNull.Value
Else
Me.Adapter.InsertCommand.Parameters(0).Value = CType(ThumbNailPhoto,Byte())
End If
If (ThumbnailPhotoFileName Is Nothing) Then
Me.Adapter.InsertCommand.Parameters(1).Value = System.DBNull.Value
Else
Me.Adapter.InsertCommand.Parameters(1).Value = CType(ThumbnailPhotoFileName,String)
End If
If (LargePhoto Is Nothing) Then
Me.Adapter.InsertCommand.Parameters(2).Value = System.DBNull.Value
Else
Me.Adapter.InsertCommand.Parameters(2).Value = CType(LargePhoto,Byte())
End If
If (LargePhotoFileName Is Nothing) Then
Me.Adapter.InsertCommand.Parameters(3).Value = System.DBNull.Value
Else
Me.Adapter.InsertCommand.Parameters(3).Value = CType(LargePhotoFileName,String)
End If
Me.Adapter.InsertCommand.Parameters(4).Value = CType(ModifiedDate,Date)
Dim previousConnectionState As System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State
Me.Adapter.InsertCommand.Connection.Open
Try
Return Me.Adapter.InsertCommand.ExecuteNonQuery
Finally
If (previousConnectionState = System.Data.ConnectionState.Closed) Then
Me.Adapter.InsertCommand.Connection.Close
End If
End Try
End Function
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)> _
Public Overloads Overridable Function Update(ByVal ThumbNailPhoto() As Byte, ByVal ThumbnailPhotoFileName As String, ByVal LargePhoto() As Byte, ByVal LargePhotoFileName As String, ByVal ModifiedDate As Date, ByVal Original_ProductPhotoID As Integer, ByVal Original_ThumbnailPhotoFileName As String, ByVal Original_LargePhotoFileName As String, ByVal Original_ModifiedDate As Date, ByVal ProductPhotoID As Integer) As Integer
If (ThumbNailPhoto Is Nothing) Then
Me.Adapter.UpdateCommand.Parameters(0).Value = System.DBNull.Value
Else
Me.Adapter.UpdateCommand.Parameters(0).Value = CType(ThumbNailPhoto,Byte())
End If
If (ThumbnailPhotoFileName Is Nothing) Then
Me.Adapter.UpdateCommand.Parameters(1).Value = System.DBNull.Value
Else
Me.Adapter.UpdateCommand.Parameters(1).Value = CType(ThumbnailPhotoFileName,String)
End If
If (LargePhoto Is Nothing) Then
Me.Adapter.UpdateCommand.Parameters(2).Value = System.DBNull.Value
Else
Me.Adapter.UpdateCommand.Parameters(2).Value = CType(LargePhoto,Byte())
End If
If (LargePhotoFileName Is Nothing) Then
Me.Adapter.UpdateCommand.Parameters(3).Value = System.DBNull.Value
Else
Me.Adapter.UpdateCommand.Parameters(3).Value = CType(LargePhotoFileName,String)
End If
Me.Adapter.UpdateCommand.Parameters(4).Value = CType(ModifiedDate,Date)
Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Original_ProductPhotoID,Integer)
If (Original_ThumbnailPhotoFileName Is Nothing) Then
Me.Adapter.UpdateCommand.Parameters(6).Value = CType(1,Integer)
Me.Adapter.UpdateCommand.Parameters(7).Value = System.DBNull.Value
Else
Me.Adapter.UpdateCommand.Parameters(6).Value = CType(0,Integer)
Me.Adapter.UpdateCommand.Parameters(7).Value = CType(Original_ThumbnailPhotoFileName,String)
End If
If (Original_LargePhotoFileName Is Nothing) Then
Me.Adapter.UpdateCommand.Parameters(8).Value = CType(1,Integer)
Me.Adapter.UpdateCommand.Parameters(9).Value = System.DBNull.Value
Else
Me.Adapter.UpdateCommand.Parameters(8).Value = CType(0,Integer)
Me.Adapter.UpdateCommand.Parameters(9).Value = CType(Original_LargePhotoFileName,String)
End If
Me.Adapter.UpdateCommand.Parameters(10).Value = CType(Original_ModifiedDate,Date)
Me.Adapter.UpdateCommand.Parameters(11).Value = CType(ProductPhotoID,Integer)
Dim previousConnectionState As System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
Me.Adapter.UpdateCommand.Connection.Open
Try
Return Me.Adapter.UpdateCommand.ExecuteNonQuery
Finally
If (previousConnectionState = System.Data.ConnectionState.Closed) Then
Me.Adapter.UpdateCommand.Connection.Close
End If
End Try
End Function
End Class
End Namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -