Results 1 to 12 of 12
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ADODB Mistery!!! (2000)

    I use this two conn thge first work and second have error see images attached:
    FIRST:
    Dim StringaDiConnessione
    StringaDiConnessione = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:PUBBLICAGAFPORTALBNLVITADbf;Extended Properties=dBASE IV;User ID=Admin;Password="
    Dim OggettoConnessione As Object, OggettoRecordset As Object
    Set OggettoConnessione = CreateObject("ADODB.Connection")
    OggettoConnessione.Open StringaDiConnessione
    Set OggettoRecordset = CreateObject("ADODB.Recordset")
    'SELEZIONA IL FILE DBF DA CARICARE - USARE NOME SENZA ESTENSIONE
    'BnlVita_Ev.DBF
    Set OggettoRecordset = OggettoConnessione.Execute("SELECT * from BnlVita")

    SECOND:
    Dim StringaDiConnessione
    StringaDiConnessione = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:PUBBLICAGAFPORTALBNLVITADbf;Extended Properties=dBASE IV;User ID=Admin;Password="
    Dim OggettoConnessione As Object, OggettoRecordset As Object
    Set OggettoConnessione = CreateObject("ADODB.Connection")
    OggettoConnessione.Open StringaDiConnessione
    Set OggettoRecordset = CreateObject("ADODB.Recordset")
    'SELEZIONA IL FILE DBF DA CARICARE - USARE NOME SENZA ESTENSIONE
    'BnlVita_Ev.DBF
    Set OggettoRecordset = OggettoConnessione.Execute("SELECT * from BnlVita_EV")

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADODB Mistery!!! (2000)

    The name of a DBase file should not be longer than 8 characters. BnlVita_EV is 10 characters long.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Mistery!!! (2000)

    WOW and now?
    No possible to rename the is a file generated form Host...

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADODB Mistery!!! (2000)

    Can't you change the name of the file after it has been generated?

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Mistery!!! (2000)

    No...Admin no permit this operation...
    But i have idea:
    Copy the file in a SERVICE dir from the original with a name 8 character and store in other dir similar D:PUBBLICAGAFPORTALSERVICEdbfile01.dbf
    wath you think?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADODB Mistery!!! (2000)

    That should work.

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Mistery!!! (2000)

    this code when run appeaa a dos window to select a param
    I want overwrite exissting file...

    Sub Test()
    Dim sDestinationDirectory, sSourceDirectory As String
    sSourceDirectory = "GCD01F4500DATIPUBBLICAGAFPORTALBNLVITADbfBnlVita_ ev.dbf"
    sDestinationDirectory = "C:BackupBnlVita01.dbf"
    Shell "xcopy " & sSourceDirectory & " " & sDestinationDirectory, vbMinimizedNoFocus
    End Sub

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADODB Mistery!!! (2000)

    You can use

    FileCopy sSourceDirectory, sDestinationDirectory

    instead of using Shell and xcopy.

    Note: BnlVita01 is still too long.

  9. #9
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Mistery!!! (2000)

    OK RESOLVED ALL!!!!!!!!!!
    Tks, Hans.

  10. #10
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Mistery!!! (2000)

    Sorry me Hans...
    But after select * from....
    how to count all records?.
    Tks.

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADODB Mistery!!! (2000)

    You can use

    Set OggettoRecordset = OggettoConnessione.Execute("SELECT Count(*) AS Conta FROM BnlVita")
    var_Conta = OggettoRecordset!Conta

    or something similar.

  12. #12
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Mistery!!! (2000)

    NO DUBT!
    EXCELLENT...
    Tks.

Posting Permissions

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