CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: ADO

  1. #1
    Join Date
    Aug 1999
    Posts
    45

    ADO

    Hi,

    Adding fields to database, if I use the Stand-alone Recordsets, which
    appends fields to the Fields collection, and finally open it:

    rs.Fields.Append "FirstName" ,adChar,50
    rs.Fields.Append "LastName" ,adChar,50
    rs.Open

    The problem is I do not know how to a associate the added Fields collection
    to the "Employees" table I want to create.

    I tried: rs.Open "Employees", cnn,adOpenStatic, adLockOptimistic
    and get error ---->[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot find the input table or query 'Employees'. Make sure it exists and that its name is spelled correctly.

    Please show me the syntax

    Thanks


  2. #2
    Join Date
    Nov 1999
    Posts
    7

    Re: ADO

    You can try using ADOX for which you need to set reference to msadox.dll

    Just try the sample for reference.
    Sub CreateTable()

    Dim tbl As New Table
    Dim cat As New ADOX.Catalog

    'Open the catalog.
    ' Open the Catalog.
    cat.ActiveConnection = _
    "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=dbname;"

    tbl.Name = "MyTable"
    tbl.Columns.Append "Column1", adInteger
    tbl.Columns.Append "Column2", adInteger
    tbl.Columns.Append "Column3", adVarWChar, 50
    cat.Tables.Append tbl

    End Sub


  3. #3
    Join Date
    Aug 1999
    Posts
    45

    Re: ADO

    Thanks for your code.
    I really appreciate it.


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

Featured