Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8662157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:39:58+00:00 2026-06-12T16:39:58+00:00

How do you use the connection string on a local database in a way

  • 0

How do you use the connection string on a local database in a way that would allow you to transfer the project folder from one computer to another, without having to modify the connection string?

Not like this

connection_String As String = "Data Source=C:\Users\Kyle\Desktop\CSCI_388_Group_Project\CSCI_388_Group_Project\CSCI_388_Group_Project\CSCI_388_Group_Project_Database.sdf"

More like this

connection_String As String = "Data Source=|DataDirectory|\CSCI_388_Group_Project_Database.sdf"

If I try to enter the second example into the connection field under the database properties I get an illegal character error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:39:59+00:00Added an answer on June 12, 2026 at 4:39 pm

    The Environment class contains most of the paths you’ll need.

    You can call Environment.GetFolderPath to get a special directory. For example, to get the My Documents directory, call Environment.GetFolderPath(Environment.SpecialFolder.Personal).

    You can browse all of the special folders here:
    http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx

    In your example specifically, you’d use the following:

    connection_String As String = _
        "Data Source=" & 
        Path.Combine(
            Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
            "CSCI_388_Group_Project_Database.sdf" )
    

    Alternative:
    Is it possible to just ask the user? If it’s on their desktop, they might move it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to save connection string in XML so that I can subsequently use that
I have a local database table that contains 50+ external data sources from which
Need example how to create new local database and a connection string, if possible
I've got a mission-critical Access 2003 database that changed from a local MDB, to
I have a SMTP account that does not use encrypted connection. I can use
The security policy at our client's production environment requires that we use separate connection
I've designed a C# game that makes use of an Access .mdb database file
I have an ODBC connection to a database of which I need one table
I wrote a program with c# and i use database as local database and
I am developing a client system that needs a small local database. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.