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

Thread: Adodc

  1. #1
    Join Date
    Nov 2000
    Location
    IL, U.S.A.
    Posts
    218

    Adodc

    I am still trying to connect my Adodc1 control to the database file that is in the same folder as my executable file. I want to be able to burn the program onto a disk and make it work.
    I have this code and it does not work.

    Dim dbName As String

    dbName = App.Path & "\NameandPassords.mdb"
    adoNamesAndPasswordsDatabase.ConnectionString = App.Path & "\NameandPassords.mdb"



  2. #2
    Join Date
    Feb 2001
    Posts
    54

    Re: Adodc

    Hello Drew:

    If I understand you correct you want to type in your own password and Userid. For to use ADODC to get to an Oracle table. I used this code to do it at my home PC. You use Access Password for the Oracle Password and get rid of Userid

    Private Sub Command2_Click()
    Adodc1.RecordSource = "Select " & Text3.Text & _
    " from " & Text4.Text & _
    " WHERE " & Text5.Text & "=" & Text6.Text
    Adodc1.Refresh
    End Sub

    Private Sub Command3_Click()
    Adodc1.ConnectionString = "Provider=MSDAORA. 1;Password=" & Text2.Text & ";User ID=" & Text1.Text & ";Persist Security Info=True"
    Adodc1.CommandType = adCmdUnknown
    End Sub


    I hope this will help you. If you need more help please send back a reply.



  3. #3
    Join Date
    Nov 2000
    Location
    IL, U.S.A.
    Posts
    218

    Re: Adodc

    My problem is that I need to burn my program onto a CD when I hand it in to my teacher. The program has more than one database. All of the files,forms and databases for the program are in one folder. The path to the database on my computer will not be the same path to the database as the teachers computer. I was trying to do a App.path code in my main form so the Adodc1 control would go directly to where my database is located which is in the same folder that the executable is located. It did not work the way I have coded it. I still can't figure it out.


  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Adodc

    You can use app.path, but you must call your executable directly from the folder. Ie: make your setup, then search for your exe, then make a shortcut to it where it effectively is, then cut and paste the sortcut on your desktop. Then you can run it from shortcut on desktop and App.path should return the path to your executable (check the shortcut properties right clicking on it and look for "target..." and "start in...").

    Hope it helpded
    Cesare Imperiali

    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Apr 2001
    Posts
    1

    Re: Adodc

    It may be too late now, but by any chance are you storing your executable and MDB in the root directory? If the executable is running from root (c:\) then app.path will return "c:\" thus a line such as app.path & "\mydb.MDB" will return "c:\\mydb.mdb" which is not valid. You can test the app.path and then set the path to the MDB as follows

    If Right(App.Path,1) = "\" Then
    dbname = app.apth & "NameandPassords.mdb"
    Else
    dbname = App.path & "\Nameandpasswords.mdb"
    End If

    Then for the adoNames connections tring you can just use adoNamesAndPasswordsDatabase.ConnectionString = App.path & dbname

    Although I must say that I am not sure your connection string is right. I don't have too much experience with ADODC controls, but your connection string looks wrong. Usually there are Provider= and Source = in the string.




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