Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

Connection string...

I have an application with the following connection code where the database is uploaded to the application:
        '*** Create a connection string with the connection string builder object
        Dim conStrBldr As New SqlConnectionStringBuilder
        With conStrBldr
            .DataSource = ".\SQLExpress"
            .AttachDBFilename = "NORTHWIND.MDF"
            .IntegratedSecurity = True
        End With

Open in new window


Question: How can I modify this code where (the database is not included with the application) the connection string is:

Data Source=.;Initial Catalog=WSCGSoftware;Integrated Security=True

Thank you.
Avatar of Johnny Newbee
Johnny Newbee
Flag of United States of America image

You tried not to include .AttachDBFilename but point out the exact location in .datasource?
i.e.
.datasource=app.path & "\your.mdf"
Avatar of Mike Eghtebas

ASKER

You mean like:

        '*** Create a connection string with the connection string builder object
        Dim conStrBldr As New SqlConnectionStringBuilder
        With conStrBldr
            .DataSource = app.path & "\WSCGSoftware.mdf"
            .IntegratedSecurity = True
        End With

Open in new window


Just use "app.path" as you have?

FYI, I also have:  csWSCGSoftware.xml

<?xml version="1.0" encoding="utf-8" ?>
<connection>
  Data Source=.;Initial Catalog=WSCGSoftware;Integrated Security=True
</connection>

Open in new window

Yes, you tried to run? Error?
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial