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. database connection problem

database connection problem

Scheduled Pinned Locked Moved C#
csharpdatabasehelpsql-serversysadmin
14 Posts 4 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.
  • E Erdinc27

    hi all i am just beginner in c# and i want to make a PhoneBook project by using ADO.Net.. and i use SQL Server 2005 Express Edition for my database but i have a problem while connecting database..in the error it says: "Cannot database "Kisiler" requested by the login.The login failed.The login failed for user 'Computer\SQLEXPRESS'" my connection string is like that : SqlConnection con = new SqlConnection("Data source=COMPUTER\\SQLEXPRESS;initial catalog=Kisiler;integrated security=True"); i checked services after that error..everything looks running when i looked at SQL Server Configuration manager what should i do now ?

    M Offline
    M Offline
    MNantu
    wrote on last edited by
    #4

    Try changing the Data Source to Data Source=.\\SQLEXPRESS (Assuming you're using the default instance.) You can also check out connectionstrings.com[^] Hope this helps =)

    E 1 Reply Last reply
    0
    • L lalit14

      SqlConnection con = new SqlConnection("Data source=COMPUTER\\SQLEXPRESS;initial catalog=Kisiler;integrated security=True**; User id=sa; Password=123456**"); Use this. but do remember to type ur userid and password Regards Lalit Manik

      E Offline
      E Offline
      Erdinc27
      wrote on last edited by
      #5

      thanks for the reply friend i tried the string u wrote but still i get same error and i didnt use any password while i was creating my table...i mean i use 'Windows Authentication' mode u have any else suggesstion ?

      1 Reply Last reply
      0
      • P puri keemti

        Problem is with connection string. User name and password credentials are missing there....

        M Offline
        M Offline
        MNantu
        wrote on last edited by
        #6

        When connecting to a database with Integrated Security set to true, I don't think you need to specify User ID and Password. :)

        1 Reply Last reply
        0
        • M MNantu

          Try changing the Data Source to Data Source=.\\SQLEXPRESS (Assuming you're using the default instance.) You can also check out connectionstrings.com[^] Hope this helps =)

          E Offline
          E Offline
          Erdinc27
          wrote on last edited by
          #7

          hi i checked the site but as i see my connection string is the same in the site i give permission that user to use the database but still i have error :(

          M 1 Reply Last reply
          0
          • E Erdinc27

            hi i checked the site but as i see my connection string is the same in the site i give permission that user to use the database but still i have error :(

            M Offline
            M Offline
            MNantu
            wrote on last edited by
            #8

            Which OS do you use by the way

            E 1 Reply Last reply
            0
            • M MNantu

              Which OS do you use by the way

              E Offline
              E Offline
              Erdinc27
              wrote on last edited by
              #9

              i use windows XP

              L 2 Replies Last reply
              0
              • E Erdinc27

                i use windows XP

                L Offline
                L Offline
                lalit14
                wrote on last edited by
                #10

                Try "Integrated Security=false" and the above code i have given... i Hope it will work Regards Lalit Manik

                1 Reply Last reply
                0
                • E Erdinc27

                  i use windows XP

                  L Offline
                  L Offline
                  lalit14
                  wrote on last edited by
                  #11

                  Temme 1 thing, the account from which u logged in to Ur computer have rights to access the SQl?

                  E 1 Reply Last reply
                  0
                  • L lalit14

                    Temme 1 thing, the account from which u logged in to Ur computer have rights to access the SQl?

                    E Offline
                    E Offline
                    Erdinc27
                    wrote on last edited by
                    #12

                    yeah i have given permission to that user but still it says it doesnt have to reach the db

                    M 1 Reply Last reply
                    0
                    • E Erdinc27

                      yeah i have given permission to that user but still it says it doesnt have to reach the db

                      M Offline
                      M Offline
                      MNantu
                      wrote on last edited by
                      #13

                      Is database server running on your local machine ?

                      E 1 Reply Last reply
                      0
                      • M MNantu

                        Is database server running on your local machine ?

                        E Offline
                        E Offline
                        Erdinc27
                        wrote on last edited by
                        #14

                        yeah it works man do you think it happens becuase of installation or some another options ??

                        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