MS VS-2005 Connection String

Posted on 2007-09-30
Last Modified: 2008-01-09
I have MS SQL-2005 and MS VS-2005 with SP1, I am using following connection string on starting of page.

Connection String:
Dim cnString As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=DLI_DB;Persist Security Info=True;User ID=sa; password: applmgr")
System.ArgumentException was unhandled by user code
Message="Format of the initialization string does not conform to specification starting at index 87."

Please help where I am doing mistake?
Question by:Mehram
    LVL 48

    Expert Comment

    Try to change to this

    Dim cnString As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=DLI_DB;Persist Security Info=True;User ID=sa; Password=applmgr")
    LVL 12

    Accepted Solution

    you can check here all types of connection strings, which sutable for u.

    Author Comment

    jpaulino, no progress
    LVL 48

    Expert Comment

    Normally its an attach database and the connectionstring should be like this

    Dim cnString As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename='|DataDirectory|\DLI_DB.MDF';Integrated Security=True;User Instance=True;User ID=sa; Password=applmgr")

    The best way to check it is to use any wizard (like datagridview, combobox, etc) and after your select the database and test it you can see the connection string. That will work for shure.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now