-
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!
-
Re: Connection !
try removing the dot:
Code:
cnProdaja = New Data.SqlServerCe.SqlCeConnection("Data Source =\pocket.sdf;")
-
Re: Connection !
-
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.
-
Re: Connection !