Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dataset
Message
De
22/12/2005 01:02:58
 
 
À
21/12/2005 11:59:23
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Versions des environnements
OS:
Windows Server 2003
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01079635
Message ID:
01080096
Vues:
41
You need to have a primary key defined, and then you won't get duplicates. Say you want to key off of a User ID, then you'd need to do something like this (syntax might be off a bit, I'm just typing this off the top of my head, and I'm never sure about VB syntax anyway):
        ds = New DataSet

        Try
            For i As Integer = 1 To 4
                tm = ConfigurationSettings.AppSettings("telemagic" & i.ToString) & "common"
                oleconect.ConnectionString = "data source =" & tm & proveedor
                olecommand.CommandText = "select user,name from users "
                oleadapter.SelectCommand = olecommand
                olecommand.Connection = oleconect
                oleadapter.Fill(ds, "users")
                ds.Tables("users").PrimaryKey  = new DataColumn[] {ds.Tables("users").Columns("userid")}

            Next

            Return ds
>config file
>
>
>add key="telemagic1" value="q:\gestel1\tm4\"
>add key="telemagic2" value="q:\gestel2\tm4\"
>add key="telemagic3" value="q:\gestel3\tm4\"
>add key="telemagic4" value="q:\gestel4\tm4\"
>
>
>
>Public Function usuarios(ByRef ds As DataSet) As DataSet
>        Dim tm As String
>        Dim proveedor As String = ";provider=vfpoledb.1"
>        Dim olecommand As New OleDbCommand
>        Dim oleadapter As New OleDbDataAdapter
>        ds = New DataSet
>        Try
>            For i As Integer = 1 To 4
>                tm = ConfigurationSettings.AppSettings("telemagic" & i.ToString) & "common"
>                oleconect.ConnectionString = "data source =" & tm & proveedor
>                olecommand.CommandText = "select user,name from users "
>                oleadapter.SelectCommand = olecommand
>                olecommand.Connection = oleconect
>                oleadapter.Fill(ds, "users")
>
>            Next
>            Return ds
>        Catch ex As Exception
>            MsgBox(ex.ToString)
>        End Try
>    End Function
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform