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. LINQ
  4. How to setting ConnectionString of LinqtoSql's dbml

How to setting ConnectionString of LinqtoSql's dbml

Scheduled Pinned Locked Moved LINQ
questiontutorial
3 Posts 3 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.
  • J Offline
    J Offline
    jason_mf
    wrote on last edited by
    #1

    I Drop Table from servermanagent to dbml file. Then I use linqDataSource bind GridView is OK. but I run in another computer, report exception: not find right SqlServer or SqlInstance. I found the .designer.cs file get ConnectionString from settings file, so I changed it ,get connectionstring from web.config, but the same exception also happen. How do I ? Thanks.

    D M 2 Replies Last reply
    0
    • J jason_mf

      I Drop Table from servermanagent to dbml file. Then I use linqDataSource bind GridView is OK. but I run in another computer, report exception: not find right SqlServer or SqlInstance. I found the .designer.cs file get ConnectionString from settings file, so I changed it ,get connectionstring from web.config, but the same exception also happen. How do I ? Thanks.

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #2

      Is the SQLServer available on that other machine? Have you tried using the SQL management to connect to your db? If your Server is installed on your computer than it won't find it on your friend computer. Some work needs to be done. As well as check the ports in use by SQL => maybe they are firewalled. And many other. If it's just a test project so that you can learn/exercise I sugest you use the File Based Approach from the SQL Express. That way you can just copy the .mdf file with your binaries.

      modified on Tuesday, March 9, 2010 1:36 PM

      1 Reply Last reply
      0
      • J jason_mf

        I Drop Table from servermanagent to dbml file. Then I use linqDataSource bind GridView is OK. but I run in another computer, report exception: not find right SqlServer or SqlInstance. I found the .designer.cs file get ConnectionString from settings file, so I changed it ,get connectionstring from web.config, but the same exception also happen. How do I ? Thanks.

        M Offline
        M Offline
        Michael J Eber
        wrote on last edited by
        #3

        Establish a connection string in your app.config Then your calls to the database will be as follows: using ( MyContext context = new MyContext( ConfigurationManager.ConnectionStrings["mydb"].connectionstring)) { }

        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