Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Specifying the table name
Message
De
31/01/2006 16:55:15
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
 
À
31/01/2006 16:34:08
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Divers
Thread ID:
01092068
Message ID:
01092074
Vues:
21
>In the following function, I cannot define the name of the table I wish to have in the data adapter fill command. The second parameter is not available. However, wherever I look on the net, everyone is able to pass a second parameter to the data adapter fill command.
>
>
>    ' SQL exec
>    ' expC1 SQL command
>    ' expO1 Connection
>    Public Function SQLExec(ByVal tcSQL As String, ByVal tcConnection As String) As Boolean
>        InitializeDataObject(nSQLMode, tcConnection, tcSQL)
>        Dim llSuccess As Boolean
>        llSuccess = False
>        Try
>            oCommand.Connection = oConnection
>            oCommand.CommandText = tcSQL
>
>            ' Only add the parameters if we have some
>            If Not oParameters2 Is Nothing Then
>                For Each oDataParameter In oParameters2
>                    oCommand.Parameters.Add(oDataParameter)
>                Next
>            End If
>
>            oDataAdapter.SelectCommand = oCommand
>            oDataSet = New DataSet
>
>            ' By default, .NET does not add the specific field length, which is needed in XML as at the other end
>            ' someone would always get memo field instead of character field
>            oDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
>
>            oDataAdapter.Fill(oDataSet)
>
Michel,

The Fill method only accepts a datatable and tablename in the derived classes (SqlDataAdapter, OleDbDataAdapter, etc..). Is oDataSet one of the derived classes?

Also, to get the full metadata from the provider, call oDataAdapter.FillSchema before retrieving the data. This will give you column lengths, scale, precision, and constraints.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform