By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

Sql Connectionstring

OuTCasT
100+
P: 374
Hi all.

I have a complete application now.
I want to save my sql database in my project bin/debug folder so that it can read directly from there.

I just cant seem to get the connectionstring correct.

i know its something like

Expand|Select|Wrap|Line Numbers
  1. MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " + Application.StartupPath + "\MyDataBase.mdb")
  2.  
but that is for an Access Database.
i have a sql database.

Can anyone help
Feb 5 '08 #1
Share this Question
Share on Google+
2 Replies


ck9663
Expert 2.5K+
P: 2,878
check this out

-- ck
Feb 5 '08 #2

OuTCasT
100+
P: 374
check this out

-- ck

Hi ck

so this would be my answer

Expand|Select|Wrap|Line Numbers
  1. Driver={SQL Native Client};Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf; Database=dbname;Trusted_Connection=Yes
  2.  
The database is already in SQL manager, do i need to attach it again from the other location ?
Feb 6 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.