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

  • Home
  • SEARCH
  • 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 8083067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:20:21+00:00 2026-06-05T17:20:21+00:00

We are going to change the connection string in Settings.vb so we don’t need

  • 0

We are going to change the connection string in Settings.vb so we don’t need to worry about what it is when our app runs on a different computer other than the development computer.

Our code looks like this:

Partial Friend NotInheritable Class MySettings

    Dim strComputerName As String
    Dim strConnectionString As String

    Private Sub MySettings_SettingsLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded

        '  strComputerName = 

        ' Build a new construction string.
        '---------------------------------
        strConnectionString = "Data Source=" & strComputerName & "\sqlexpress" & _
                              ";Integrated Security=True;User Instance=True"

        ' Change to the new connection string.
        '-------------------------------------
        Me.Item("Kemal_Business_SolutionConnectionString") = (strConnectionString)
    End Sub
End Class

Can you tell me how to obtain the computer name because we need that information to place into the “Data Source=” part of the connection string?

Update: Here is what the final coding looks like. Thanks everyone for your replies:

Partial Friend NotInheritable Class MySettings

    Dim strComputerName As String
    Dim strConnectionString As String

    Private Sub MySettings_SettingsLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded

        strComputerName = Environment.MachineName
        'strComputerName = My.Computer.Name

        ' Build a new construction string.
        '---------------------------------
        strConnectionString = "Data Source=" & strComputerName & "\sqlexpress;" & _
                              "Initial Catalog=""Kemal Business Solution"";" & _
                              "Integrated Security=True"

        ' Change to the new connection string.
        '-------------------------------------
        Me.Item("Kemal_Business_SolutionConnectionString") = (strConnectionString)
    End Sub
End Class
  • 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-05T17:20:22+00:00Added an answer on June 5, 2026 at 5:20 pm

    Or the far more arcane.

    strComputerName = Environment.MachineName
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need an sql script that is going to change the datasource of all
My application is already developed and now we are going to change the connection
I am going to change my working sphere from Enterprise Web Applications written for
I am going to change my hosting, and allready rented a new server. Now
Is the .Net 4 Framework going to change before the go-live or can we
I'm designing a database application where data is going to change over time. I
set dateformat dmy select isdate('31/1/2012') I thought by going into Change the format of
I want to create a clone of the plug-in. I'm going to change the
I am writing an application which is going to allows users to change the
I have set the connection string of my dataset(typed) as Data Source=MyHomeServer\SQLEXPRESS;Initial Catalog=dbTestSharing;Integrated Security=True

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.