Click here to Skip to main content
15,917,455 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Database connection problem in vb.net Pin
P P Vilsad9-May-07 4:18
P P Vilsad9-May-07 4:18 
GeneralRe: Database connection problem in vb.net Pin
hbk_leo9-May-07 8:44
hbk_leo9-May-07 8:44 
GeneralRe: Database connection problem in vb.net Pin
Dave Kreskowiak9-May-07 9:27
mveDave Kreskowiak9-May-07 9:27 
GeneralRe: Database connection problem in vb.net Pin
hbk_leo9-May-07 19:24
hbk_leo9-May-07 19:24 
AnswerRe: Database connection problem in vb.net Pin
P P Vilsad9-May-07 17:51
P P Vilsad9-May-07 17:51 
GeneralRe: Database connection problem in vb.net Pin
hbk_leo9-May-07 19:28
hbk_leo9-May-07 19:28 
GeneralRe: Database connection problem in vb.net Pin
P P Vilsad10-May-07 16:54
P P Vilsad10-May-07 16:54 
AnswerRe: Database connection problem in vb.net Pin
Dave Kreskowiak9-May-07 4:38
mveDave Kreskowiak9-May-07 4:38 
The |DataDirectory| portion of the AttachDbFilename path is only usable if your database file is in either the Data folder of the SQL Server Program Files folder or when using ClickOnce Deployment - I can't remember which.

You have to replace this with the full path to your database .MDF file for the connection string to work. If your database is in your applications .EXE folder, you can do something like this to get it work:
Dim dbPath As String = Path.Combine(Application.StartupPath, "mydatabase.mdf")
Dim connString As String = String.Format("Data Source=.\SQLEXPRESS;AttachDbFilename={0};Integrated Security=True;User Instance=True", dbPath)



A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: Database connection problem in vb.net Pin
hbk_leo9-May-07 8:00
hbk_leo9-May-07 8:00 
GeneralRe: Database connection problem in vb.net Pin
Dave Kreskowiak9-May-07 9:25
mveDave Kreskowiak9-May-07 9:25 
GeneralRe: Database connection problem in vb.net Pin
hbk_leo9-May-07 19:31
hbk_leo9-May-07 19:31 
QuestionInsert data to word template Pin
Jats_4ru8-May-07 20:18
Jats_4ru8-May-07 20:18 
AnswerRe: Insert data to word template Pin
Dave Kreskowiak9-May-07 4:32
mveDave Kreskowiak9-May-07 4:32 
GeneralRe: Insert data to word template Pin
Jats_4ru9-May-07 22:55
Jats_4ru9-May-07 22:55 
QuestionVB communication problem Pin
Mr ericsson8-May-07 19:29
Mr ericsson8-May-07 19:29 
AnswerRe: VB communication problem Pin
Dave Kreskowiak9-May-07 4:30
mveDave Kreskowiak9-May-07 4:30 
QuestionHowTO: Packet Capture / Redirect URL Pin
Sunil KC8-May-07 19:15
Sunil KC8-May-07 19:15 
AnswerRe: HowTO: Packet Capture / Redirect URL Pin
Colin Angus Mackay8-May-07 23:47
Colin Angus Mackay8-May-07 23:47 
GeneralRe: HowTO: Packet Capture / Redirect URL Pin
Sunil KC9-May-07 0:50
Sunil KC9-May-07 0:50 
GeneralRe: HowTO: Packet Capture / Redirect URL Pin
Dave Kreskowiak9-May-07 4:25
mveDave Kreskowiak9-May-07 4:25 
AnswerRe: HowTO: Packet Capture / Redirect URL Pin
Colin Angus Mackay8-May-07 23:48
Colin Angus Mackay8-May-07 23:48 
AnswerRe: HowTO: Packet Capture / Redirect URL Pin
Dave Kreskowiak9-May-07 4:24
mveDave Kreskowiak9-May-07 4:24 
QuestionServer error Pin
n_gchaitra8-May-07 18:29
n_gchaitra8-May-07 18:29 
AnswerRe: Server error Pin
Dave Kreskowiak9-May-07 3:29
mveDave Kreskowiak9-May-07 3:29 
QuestionVB.Net Service Question Pin
tcombs078-May-07 18:25
tcombs078-May-07 18:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.