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 i use the connection string for making a connection object..

How i use the connection string for making a connection object..

Scheduled Pinned Locked Moved C#
question
4 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.
  • D Offline
    D Offline
    ddravin2000
    wrote on last edited by
    #1

    Hi ,    i made a connection string in app.config file. and i want to use this into my .cs file while creating connection object...          objSqlConnection1.ConnectionString = ? please post the solution..

    U 1 Reply Last reply
    0
    • D ddravin2000

      Hi ,    i made a connection string in app.config file. and i want to use this into my .cs file while creating connection object...          objSqlConnection1.ConnectionString = ? please post the solution..

      U Offline
      U Offline
      User 4467139
      wrote on last edited by
      #2

      if your connection string is like this add name="conn1" connectionString="string1" ur access will be like this. string conn = ConfigurationManager.ConnectionStrings[conn1].ConnectionString;

      D 1 Reply Last reply
      0
      • U User 4467139

        if your connection string is like this add name="conn1" connectionString="string1" ur access will be like this. string conn = ConfigurationManager.ConnectionStrings[conn1].ConnectionString;

        D Offline
        D Offline
        ddravin2000
        wrote on last edited by
        #3

        thanks !       but it gives an error "ConfigurationManager" does not exist into current context

        U 1 Reply Last reply
        0
        • D ddravin2000

          thanks !       but it gives an error "ConfigurationManager" does not exist into current context

          U Offline
          U Offline
          User 4467139
          wrote on last edited by
          #4

          add a reference in ur class file. using System.Configuration;

          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