Results 1 to 5 of 5

Thread: Connection !

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2007
    Posts
    192

    Connection !

    Code:
    cnProdaja = New Data.SqlServerCe.SqlCeConnection("Data Source =.\pocket.sdf;")
          
            Dim rsProdaja As System.Data.SqlServerCe.SqlCeDataReader
            cnProdaja.Open()
            Dim naredba As New System.Data.SqlServerCe.SqlCeCommand("select sifra, naziv_skladista From skladiste", cnProdaja)
            rsProdaja = naredba.ExecuteReader
            While rsProdaja.Read
                Me.ComboBox1.Items.Add(rsProdaja("naziv_skladista"))
    I try to open connection on this way but when I start program show me error :The database file cannot be found. Check the path to the database. [ File name = .\pocket.sdf ]
    My connection string is ok,I really dont know why project don't work!

  2. #2
    Member
    Join Date
    Jan 2008
    Posts
    33

    Re: Connection !

    try removing the dot:

    Code:
    cnProdaja = New Data.SqlServerCe.SqlCeConnection("Data Source =\pocket.sdf;")

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2007
    Posts
    192

    Re: Connection !

    Not work!

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Connection !

    Well - where do you think it's going to find the file??

    This is our connection string

    Code:
    Dcn.ConnectionString = "DataSource=" & strDataFolder & "\APC.sdf; Password=" & strPassword
    strDataFolder is defined like this

    Code:
        Public strBaseFolder As String = "\Program Files\APC"
        Public strDataFolder As String = strBaseFolder
    You have to specify some folder.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2007
    Posts
    192

    Resolved Re: Connection !

    Resolved

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