Sql connection-string for localhost server

前端 未结 13 2027
遇见更好的自我
遇见更好的自我 2020-12-09 01:28

I am newbie in this .NET and please don\'t mind in answering my simple question. I am trying to write a windows application, where in I am using a localhost SQLserver for da

相关标签:
13条回答
  • 2020-12-09 02:02
    string str = @"Data Source=HARIHARAN-PC\SQLEXPRESS;Initial Catalog=master;Integrated Security=True" ;
    
    0 讨论(0)
  • 2020-12-09 02:03

    Choose a database name in Initial Catalog

    Data Source=HARIHARAN-PC\SQLEXPRESS;Initial Catalog=your database name;Integrated Security=True" ;
    

    see more

    0 讨论(0)
  • 2020-12-09 02:05

    Try this connection string.

    Data Source=HARIHARAN-PC\\SQLEXPRESS;Initial Catalog=yourDataBaseName;Integrated Security=True
    

    See this link for more details http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring%28v=vs.110%29.aspx

    0 讨论(0)
  • 2020-12-09 02:05
    string str = "Data Source=HARIHARAN-PC\\SQLEXPRESS;Initial Catalog=master;Integrated Security=True" ;
    
    0 讨论(0)
  • 2020-12-09 02:09

    Do You have Internal Connection or External Connection. If you did Internal Connection then try this:

    "Data Source=.\SQLEXPRESS;AttachDbFilename="Your PAth .mdf";Integrated Security=True;User Instance=True";
    
    0 讨论(0)
  • 2020-12-09 02:12

    use this connection string :

    Server=HARIHARAN-PC\SQLEXPRESS;Intial Catalog=persons;Integrated Security=True;
    

    rename person with your database name

    0 讨论(0)
提交回复
热议问题