path to DB not working - help!?

BlueOysterCult

Regular
Joined
Oct 3, 2003
Messages
84
Hello All,

I have this project. "a CD Collection" - the user can go through a long list of CDs. I am having a problem with my database - connecting to it I should say. the error is "C:\DBs\CDColl.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server om shich the file resides."

One, how do I make sure the path is correct? I had it working at school but I am trying to work on it at home.

Two, the file does not reside on the server.

I lost my database I think? I am lost....

here's my code -

Visual Basic:
'Option Strict On
Public Class frmCdCollection
    Inherits System.Windows.Forms.Form


    'Private Sub GetNextRecord()
    '    BindingContext(DbCdCollection1, "Cds").Position += 1
    'End Sub
    Private Sub UpdateCounter()
        Dim intCount, intCurrent As Integer
        intCurrent = BindingContext(DbCdCollection1, "Cds").Position + 1
        intCount = BindingContext(DbCdCollection1, "Cds").Count
        'lblRecord.Text = intCurrent.ToString & "/" & intCount.ToString
    End Sub

    Private Sub frmCdCollection_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DbCdCollection1.Clear()
        OleDbDataAdapter1.Fill(DbCdCollection1) 'HERE IS WHERE THE DEBUGGER HIGHLIGHTS THE ERROR with the path error

        UpdateCounter()
    End Sub

    Private Sub MoveNext(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuMoveNext.Click, btnNext.Click
        BindingContext(DbCdCollection1, "Cds").Position += 1
        UpdateCounter()
    End Sub

    Private Sub MovePrevious(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                Handles mnuMovePrevious.Click, btnPrevious.Click
        BindingContext(DbCdCollection1, "Cds").Position -= 1
        UpdateCounter()
    End Sub
    Private Sub MoveFirst(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                 Handles mnuMoveFirst.Click, btnFirst.Click
        BindingContext(DbCdCollection1, "Cds").Position = 0
        UpdateCounter()
    End Sub
    Private Sub MoveLast(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                Handles mnuMoveLast.Click, btnLast.Click
        BindingContext(DbCdCollection1, "Cds").Position = BindingContext(DbCdCollection1, "Cds").Count - 1
        UpdateCounter()
    End Sub

    
    Private Sub mnuShowAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuShowAll.Click
        OleDbSelectCommand1.CommandText = _
                 "select * from Cds"
        DbCdCollection1.Clear()
        OleDbDataAdapter1.Fill(DbCdCollection1)
        UpdateCounter()
    End Sub

    Private Sub mnuByArtist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuByArtist.Click
        Dim strArtist As String, strSQL As String
        strArtist = txtArtist.Text
        strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdArtist like '%" & strArtist & "%'"
        OleDbSelectCommand1.CommandText = strSQL

        DbCdCollection1.Clear()
        OleDbDataAdapter1.Fill(DbCdCollection1)
        UpdateCounter()
    End Sub

    Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
        End
    End Sub

    Private Sub mnuByTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuByTitle.Click
        Dim strTitle As String, strSQL As String
        strTitle = txtTitle.Text
        strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdTitle like '" & strTitle & "%'"
        OleDbSelectCommand1.CommandText = strSQL

        DbCdCollection1.Clear()
        OleDbDataAdapter1.Fill(DbCdCollection1)
        UpdateCounter()
    End Sub

    Private Sub mnuByYear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuByYear.Click
        Dim strSQL As String
        strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdYear between 1988 and 1985"
        OleDbSelectCommand1.CommandText = strSQL

        DbCdCollection1.Clear()
        OleDbDataAdapter1.Fill(DbCdCollection1)
        UpdateCounter()
    End Sub

    Private Sub mnuByCategory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuByCategory.Click
        Dim strCategory As String, strSQL As String
        strCategory = txtCategory.Text
        strSQL = "select CdArtist,CdTitle, CdYear,CdKey,CdCategory from Cds where CdCategory like '%" & strCategory & "%'"
        OleDbSelectCommand1.CommandText = strSQL

        DbCdCollection1.Clear()
        OleDbDataAdapter1.Fill(DbCdCollection1)
        UpdateCounter()
    End Sub
End Class

thanks
Rob
 
Last edited by a moderator:
One, how do I make sure the path is correct? I had it working at school but I am trying to work on it at home.
Does the file "C:\DBs\CDColl.mdb" exist?
My wild guess is that it's missing!

Two, the file does not reside on the server
The server in this concept is the database server, which more or less is the database.

Three
Visual Basic:
'Sourcecode
Do NOT overpost, just the information you supplied where enough. We do not want your complete source.

Regards
/Kejpa
 
I fdidn't know I was over posting - I don't know where the problem is coming from
sorry
This can be marked as done - I won't be doing this project for a while
R
 
Back
Top