Results 1 to 2 of 2

Thread: How to open a table in a database and view them in a textbox using ADO?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    72

    How to open a table in a database and view them in a textbox using ADO?

    Firstly, I'm new to VB and using ADO.

    I have a database 'sample.mdb'. This database contain a table 'test1'.

    Here is how I open the database:


    /* Start code here

    Private Sub Form_Load()
    Dim cLocation As String, SQLstmt As String
    Dim adodc1 As New ADODB.Connection
    Dim rs1 As New ADODB.Recordset
    cLocation = "c:\sample.mdb"
    adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Jet OLEDBatabase Password=my_password_here;" & _
    "Data Source=" & cLocation & ";" & _
    "Persist Security Info=False"
    adodc1.CommandTimeout = 15
    adodc1.Open
    Set rs1 = New ADODB.Recordset
    Set rs1 = adodc1.Execute("Select * from test1 order by mykeyid", , adCmdText)
    ' adodc1.CommandType = adCmdTable
    End Sub

    */ End Code here

    It seem that the progrom startup okay but nothing appear on my form.

    If I change the format to using 'data' icon form toolbox tag, the form shown whatever i want. Because my access database is password protected, I can't use the 'data' format - 'Invalid password' message appear.

    Hope someone can provide me some idea here.

    Thanks.

  2. #2
    New Member
    Join Date
    Aug 2001
    Posts
    11

    What about your textboxes?

    you said you wanted to display your tsable in textboxes your code seems to be ok .... did you connect your textboxes right like properties? datasource, datamember etc...
    Whitebat

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width