Information générale
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Thanks Kevin,
I tried your solution. I added a DataAccessSql class for my view and I added
Imports System.Data.SqlClient
at the top and
Protected CommandTimeout As Integer = 120
just inside under the "Inherits mmDataAccessSql" of the class declaration.
I then added the VB version of FillDataSet() from mmDataAccessSql, adding your change with the CommandTimeout:
Public Overrides Sub FillDataSet(ByVal ds As DataSet, ByVal dbAdapter As IDbDataAdapter, _
ByVal tableName As String, ByVal clearOnFill As Boolean)
' If the Select command's connection is null, use the existing connection
' associated with the data access class, or create a new one
If dbAdapter.SelectCommand.Connection Is Nothing Then
If Me.Connection Is Nothing Then
Me.Connection = Me.CreateSqlConnection()
End If
dbAdapter.SelectCommand.Connection = Me.Connection
dbAdapter.SelectCommand.CommandTimeout = Me.CommandTimeout
End If
' Specify that column and primary key information is added to the DataTable
dbAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
' If specified to do so, Translate any parameters for the specified .NET Data Provider
If Me.ParameterTranslation Then
Me.TranslateParameters(dbAdapter.SelectCommand)
End If
' Cast the data adapter then use it to fill the DataSet
Dim adapter As SqlDataAdapter = CType(dbAdapter, SqlDataAdapter)
' If specified to do so and the table already exists, clear it
If clearOnFill Then
Dim dt As DataTable = ds.Tables(tableName)
If Not dt Is Nothing Then
dt.Clear()
End If
End If
' Fill the specified table in the DataSet
adapter.Fill(ds, tableName)
' Store the current select command for the current table in the
' DataTable's extended properties
Me.SaveSelectCommand(ds, tableName, dbAdapter)
End Sub
When I try to compile I get an Error:
'Public Overrides Sub FillDataSet(ds As System.Data.DataSet, dbAdapter As System.Data.IDbDataAdapter, tableName As String, clearOnFill As Boolean)' cannot shadow a method declared 'MustOverride'.
followed by a warning:
sub 'FillDataSet' shadows an overloadable member declared in the base class 'mmDataAccessSql'. If you want to overload the base method, this method must be declared 'Overloads'.
If I change the Sub to Overloads Overrides it will compile but not be called. How do I get rid of the compiler error yet have my subroutine override the base class?
Thanks,
Max...
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement