vb.net SqlConnection open DB passing PATH

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
 
G

Guest

Fabio,

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

Kerry Moorman
 
N

neodev

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top