Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to change Connection string at runtime for window application while using Linq to Sql

How to change Connection string at runtime for window application while using Linq to Sql

Scheduled Pinned Locked Moved C#
helpdatabasecsharpvisual-studiolinq
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sanket Patil
    wrote on last edited by
    #1

    Hi, Please help me to solve My problem. I am new To use Linq To Sql in VS 2008 Problem : I am using Linq To Sql to develop window aplication. I have one dataclass1.dbml file on which i have drag and drop the database table that i required for writting linq queries. At this time it saves connection string in app.config file and settings.designer.cs file which is hard coded and this is what i dont want. Because Whenever I install My application(i.e. EXE) at the Client side it is not fix that the server name is same as in connection string. I need to change it at runtime because i need to provide server name and Database name that are on the remote server. So please tell me how can i provide the connection string at runtime. Thanks

    .

    H 1 Reply Last reply
    0
    • S Sanket Patil

      Hi, Please help me to solve My problem. I am new To use Linq To Sql in VS 2008 Problem : I am using Linq To Sql to develop window aplication. I have one dataclass1.dbml file on which i have drag and drop the database table that i required for writting linq queries. At this time it saves connection string in app.config file and settings.designer.cs file which is hard coded and this is what i dont want. Because Whenever I install My application(i.e. EXE) at the Client side it is not fix that the server name is same as in connection string. I need to change it at runtime because i need to provide server name and Database name that are on the remote server. So please tell me how can i provide the connection string at runtime. Thanks

      .

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      You can either use a Connection Dialog like this[^] and let the user select it, or use the techniques used in the article for filling the lists, to locate the server/database automagically.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups