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. C# - SqlConnection Issue

C# - SqlConnection Issue

Scheduled Pinned Locked Moved C#
csharpdatabasevisual-studiohelpquestion
3 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.
  • V Offline
    V Offline
    Vikas K
    wrote on last edited by
    #1

    I'm new to C# and use VS Express 2005 and SQL Express 2005. Question: 1. I have added Employee.mdf database via Project->Add new item->SQL database 2. Using the following, but see strange things: SqlConnection sqlcon = new SqlConnection(connectionstring); - If I use connectionstring as: "Data Source=.\\SQLEXPRESS;Initial Catalog=Employee;Integrated Security=true; User Instance=True" I get error like: User domain/user passoword failed! No remote access etc strane errors - If I use connectionstring as: "Data Source=.\\SQLEXPRESS;AttachDbFilename=\"C:\\Documents and Settings\\user\\My Documents\\Visual Studio 2005\\Projects\\MyDatabase\\MyDatabase\\Employee.mdf\";Integrated Security=True;User Instance=True" Then it works fine! But in every book I see, they give the above 1st case but it does not work for me? Any idea? Is it fine to explicitly using the database path in C# project?

    O 1 Reply Last reply
    0
    • V Vikas K

      I'm new to C# and use VS Express 2005 and SQL Express 2005. Question: 1. I have added Employee.mdf database via Project->Add new item->SQL database 2. Using the following, but see strange things: SqlConnection sqlcon = new SqlConnection(connectionstring); - If I use connectionstring as: "Data Source=.\\SQLEXPRESS;Initial Catalog=Employee;Integrated Security=true; User Instance=True" I get error like: User domain/user passoword failed! No remote access etc strane errors - If I use connectionstring as: "Data Source=.\\SQLEXPRESS;AttachDbFilename=\"C:\\Documents and Settings\\user\\My Documents\\Visual Studio 2005\\Projects\\MyDatabase\\MyDatabase\\Employee.mdf\";Integrated Security=True;User Instance=True" Then it works fine! But in every book I see, they give the above 1st case but it does not work for me? Any idea? Is it fine to explicitly using the database path in C# project?

      O Offline
      O Offline
      originSH
      wrote on last edited by
      #2

      To fix the remote access denied errors: http://www.datamasker.com/SSE2005_NetworkCfg.htm[^] When using intergrated security you have setup a user in sql server for your windows username/password?

      V 1 Reply Last reply
      0
      • O originSH

        To fix the remote access denied errors: http://www.datamasker.com/SSE2005_NetworkCfg.htm[^] When using intergrated security you have setup a user in sql server for your windows username/password?

        V Offline
        V Offline
        Vikas K
        wrote on last edited by
        #3

        How to setup user in SQL with WIndows login credentials?

        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