vb.net SqlConnection open DB passing PATH

  • Thread starter Thread starter neodev
  • Start date Start date
N

neodev

Hi
I have 2 mode for open db

'Path DB
Private Const pathDB As String = "C:\...\diabolik.mdb"
'for the ole db
Private conn As New OleDbConnection
'for th sqlconnection
Private connRS As Data.SqlClient.SqlConnection

If I want open Local DB using a path and not using DNS
because I doen't know the mode.

For OleDbConnection I write :
conn.ConnectionString = _
"Provider = Microsoft.Jet.OLEDB.4.0;Data Source =" & pathDB

where is the method for open connection to local db
using your path and not dns string or othen

connRS.ConnectionString = _
"Server=(local);Initial Catalog=diabolik;" & _
"Data Source=(" & pathDB & ")"

but doen't work
I want know if possible using sqlconnection passing
path of DataBase ????!!!!!


HELP ME PLEASE

NEODEV
Fabio Santini
 
Fabio,

Sqlconnection is for working with Microsoft SQL Server databases, not Access
databases.

Kerry Moorman
 
OK thank Ops
but Anothe question a want fill grid with data from access

sql = "SELECT * FROM albi where RIFAnno= " & RIFAnno
If conn.State = Data.ConnectionState.Closed Then conn.Open()
cmd1 = conn.CreateCommand
cmd1.CommandText = sql
rd1 = cmd1.ExecuteReader()

gridAlbo.DataSource = rd1
gridAlbo.databind()


but vs 005 beta2 give me error in gridAlbo.databind()
DATABIND NOT IS A METHOD

ANY IDEA
thanks
fabio
 
Back
Top