Results 1 to 4 of 4

Thread: Is it Possible?

  1. #1
    Join Date
    Sep 2003
    Posts
    23

    Unanswered: Is it Possible?

    Hello,
    I just want to know if it is possible to create a Microsoft Access Database using VC++. I have version 6.0.

    I know that you can create text docs and excel docs, but Access DB's?

    Anyways, I see how to do it in VB but I need to use VC++. Thanks
    This message is a natural product made from recycled electrons. The slight
    variations in spelling and grammar enhance its individual character and
    beauty and in no way are to be considered flaws or defects.

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    Use ADOX. Here is some sample code:

    '(Create Access MDB - Scenario)
    Option Explicit

    Function Main()

    Dim sFilename
    Dim sConnectionString
    Dim oCatalog
    Dim oConn
    Dim oFSO

    ' Derive new filename - X:\Path\Export_yyyymmdd.mdb
    sFilename = DTSGlobalVariables("Path").Value & "Export_" & Year(Date) &_
    Right("0" & Month(Date), 2) & Right("0" & Day(Date), 2) & ".mdb"

    ' Check for existing instance of file and delete
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    If oFSO.FileExists(sFilename) Then
    oFSO.DeleteFile sFilename
    End If
    Set oFSO = Nothing

    ' Create empty MDB
    sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sFilename
    Set oCatalog = CreateObject("ADOX.Catalog")
    oCatalog.Create sConnectionString
    Set oCatalog = Nothing

    ' Get referemce to Access Connection and set new filename
    Set oConn = DTSGlobalVariables.Parent.Connections("Microsoft Access")
    oConn.DataSource = sFileName
    Set oConn = Nothing


    Main = DTSTaskExecResult_Success
    End Function
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Sep 2003
    Posts
    23

    Code

    Well,
    I am having some problems with the code that you posted.
    Is it in VC++/C++? It does not appear so.The Compilier does not know what Dim is. Perhaps that is VB? I am not sure. Could you let me know what language it is? thanks

    Regardless, thank you for your response.
    This message is a natural product made from recycled electrons. The slight
    variations in spelling and grammar enhance its individual character and
    beauty and in no way are to be considered flaws or defects.

  4. #4
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    The code is written in VB with a reference to ADO and ADOX.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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