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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Connecting to Database in asp.net

Connecting to Database in asp.net

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netdatabasesysadmin
8 Posts 4 Posters 1 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
    srikantha_nagaraj
    wrote on last edited by
    #1

    Hi, In my connection string if i give Server name it will not work, But if i give with servername\SQLEXPRESS it will work. But this connection string i can't use in class as it giving an error for this. Please help me.

    A A 2 Replies Last reply
    0
    • S srikantha_nagaraj

      Hi, In my connection string if i give Server name it will not work, But if i give with servername\SQLEXPRESS it will work. But this connection string i can't use in class as it giving an error for this. Please help me.

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      It's because you have installed SQL Server Express Version in your System :)

      Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

      S 1 Reply Last reply
      0
      • A Abhijit Jana

        It's because you have installed SQL Server Express Version in your System :)

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

        S Offline
        S Offline
        srikantha_nagaraj
        wrote on last edited by
        #3

        So please solve this problem?

        modified on Thursday, August 20, 2009 11:13 AM

        1 Reply Last reply
        0
        • S srikantha_nagaraj

          Hi, In my connection string if i give Server name it will not work, But if i give with servername\SQLEXPRESS it will work. But this connection string i can't use in class as it giving an error for this. Please help me.

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          srikantha_nagaraj wrote:

          But this connection string i can't use in class as it giving an error for this.

          Are we meant to guess what error? Why can't you use it, it's a valid name.

          Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

          S 1 Reply Last reply
          0
          • A Ashfield

            srikantha_nagaraj wrote:

            But this connection string i can't use in class as it giving an error for this.

            Are we meant to guess what error? Why can't you use it, it's a valid name.

            Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

            S Offline
            S Offline
            srikantha_nagaraj
            wrote on last edited by
            #5

            My Connection string is "Database=QD ;Server=BHUKRK83981D\SQLEXPRESS; Integrated Security = true;Connect Timeout=2000;" But it is giving an error as Unrecorganized escape sequence.

            J A 2 Replies Last reply
            0
            • S srikantha_nagaraj

              My Connection string is "Database=QD ;Server=BHUKRK83981D\SQLEXPRESS; Integrated Security = true;Connect Timeout=2000;" But it is giving an error as Unrecorganized escape sequence.

              J Offline
              J Offline
              Jeremy Likness
              wrote on last edited by
              #6

              You need to escape it for the slash, like this: @"Database=QD ;Server=BHUKRK83981D\SQLEXPRESS; Integrated Security = true;Connect Timeout=2000;" Or just double it up: "Database=QD ;Server=BHUKRK83981D\\SQLEXPRESS; Integrated Security = true;Connect Timeout=2000;"

              Jeremy Likness Latest Article: Whats in Your Collection? Part 1 of 3: Interfaces Blog: C#er : IMage

              S 1 Reply Last reply
              0
              • S srikantha_nagaraj

                My Connection string is "Database=QD ;Server=BHUKRK83981D\SQLEXPRESS; Integrated Security = true;Connect Timeout=2000;" But it is giving an error as Unrecorganized escape sequence.

                A Offline
                A Offline
                Ashfield
                wrote on last edited by
                #7

                Basic C# error - you need to escape the \, its nothing wrong with the connection string.

                Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

                1 Reply Last reply
                0
                • J Jeremy Likness

                  You need to escape it for the slash, like this: @"Database=QD ;Server=BHUKRK83981D\SQLEXPRESS; Integrated Security = true;Connect Timeout=2000;" Or just double it up: "Database=QD ;Server=BHUKRK83981D\\SQLEXPRESS; Integrated Security = true;Connect Timeout=2000;"

                  Jeremy Likness Latest Article: Whats in Your Collection? Part 1 of 3: Interfaces Blog: C#er : IMage

                  S Offline
                  S Offline
                  srikantha_nagaraj
                  wrote on last edited by
                  #8

                  Thanks it helped a lot.

                  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