Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
Bounding TextControl to fields.
Hello,
I'm testing a form that displays first_name and last_name from a SQL70 table called OptOut ( database is also called OptOut ).
Below is the code to establish the connection and recordset(Hope is Ok).
How should I set the following textbox control properties ? :
text1.datafield
text1.datamember
text1.datasource
-------------------------------------------------------------
Dim cnMyConnection As Connection
Dim recMyRecordSet As Recordset
Dim comMyCommand As Command
Private Sub Form_Load()
Set cnMyConnection = New Connection
Set recMyRecordSet = New Recordset
Set comMyCommand = New Command
' Establish connection
With cnMyConnection
.Provider = "SQLOLEDB"
.ConnectionString = "User ID=sa;" & _
"Data Source = WEBDEV;" & _
"Initial Catalog = Optout"
.Open
End With
' Create a command object
With comMyCommand
.ActiveConnection = cnMyConnection
.CommandText = "SELECT * FROM OptOut"
' Build the record set
Set recMyRecordSet = comMyCommand.Execute
End With
End Sub
I've been trying to display the first_name and last_name but I've been unsucssefull.
Also can I set these properties at deign time.
Thanks,
Sergio Ortiz
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