Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21236

Open Connection to MDF file

$
0
0
I've tried to connect to mdf file, but with no success..
My connection string is like this

Code:

sCon = "Server =.\SQLEXPRESS;Integrated Security = true; AttachDbFilename" & _
" = E:\Project Koperasi\KOPERASI2.mdf; User Instance = true; Trusted_Connection=Yes;"
Set oCon = New ADODB.Connection
oCon.Open sCon

if i connect to the database, i have no problem, below is the code

Code:

sCon = "Provider=SQLNCLI10;Server=DAVE-30E71AC775;Database=KOPERASI2;"
sCon = sCon & "Trusted_Connection=yes"
Set oCon = New ADODB.Connection
oCon.Open sCon

The error with the code #1 produce is:

Code:

Run-time error '-2147217887 (80040e21)':

Multiple-step OLE DB operation generated errors. Check each OLE DB status
value, if available. No work was done.

Can anyone please tell me what's wrong?

Viewing all articles
Browse latest Browse all 21236

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>