{"id":91,"date":"2018-12-05T22:04:17","date_gmt":"2018-12-05T13:04:17","guid":{"rendered":"https:\/\/r-side.net\/?p=91"},"modified":"2020-05-09T15:57:16","modified_gmt":"2020-05-09T06:57:16","slug":"post-91","status":"publish","type":"post","link":"https:\/\/r-side.net\/?p=91","title":{"rendered":"VB.NET2015(C#)\u304b\u3089SQL Server\u306b\u63a5\u7d9a\u3059\u308b(ADO.NET)"},"content":{"rendered":"<p>VB.NET\u304b\u3089SQL\u306b\u63a5\u7d9a\u3059\u308b\u306b\u306f\u3001ADO.NET\u3092\u4f7f\u7528\u3059\u308c\u3070\u826f\u3044\u3089\u3057\u3044\u3002<br \/>\nSystem.Data.SqlClient.SqlConnection\u30af\u30e9\u30b9\u3092\u4f7f\u3063\u3066\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\" title=\"\u63a5\u7d9a\">Private Con As New System.Data.SqlClient.SqlConnection\r\n\r\n'SQL\u30b5\u30fc\u30d0\u306b\u63a5\u7d9a\u3059\u308b\r\nPrivate Sub SqlOpen()\r\n    '\u63a5\u7d9a\u5148\u6307\u5b9a\r\n    Con.ConnectionString =\r\n    \"Data Source = DB-SERV\\sqlexpress;\" &amp;   '\u30b5\u30fc\u30d0\u30fc\u540d\\\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u540d\r\n    \"Initial Catalog = DBNAME;\" &amp;           '\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\r\n    \"Integrated Security = SSPI\"            '\u8a8d\u8a3c\r\n    '\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30aa\u30fc\u30d7\u30f3\r\n    Con.Open()\r\nEnd Sub<\/pre>\n<pre class=\"lang:c# decode:true \" title=\"\u63a5\u7d9a(C#)\">System.Data.SqlClient.SqlConnection Con = new System.Data.SqlClient.SqlConnection();\r\n\r\n\/\/SQL\u30b5\u30fc\u30d0\u306b\u63a5\u7d9a\u3059\u308b\r\nprivate void SqlOpen() {\r\n    \/\/\u63a5\u7d9a\u5148\u6307\u5b9a\r\n    Con.ConnectionString =\r\n    \"Data Source = DB-SERV\\\\sqlexpress;\" +  \/\/\u30b5\u30fc\u30d0\u30fc\u540d\\\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u540d\r\n    \"Initial Catalog = DBNAME;\" +           \/\/\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\r\n    \"Integrated Security = SSPI\";           \/\/\u8a8d\u8a3c\r\n    \/\/\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30aa\u30fc\u30d7\u30f3\r\n    Con.Open();\r\n}<\/pre>\n<p>\u4f7f\u3044\u65b9\u306f\u3001<br \/>\n\u30fbData Source\uff1a\u30b5\u30fc\u30d0\u30fc\u306e\u540d\u524d\u307e\u305f\u306fIP\u30a2\u30c9\u30ec\u30b9\\\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u540d\u3092\u6307\u5b9a(\\\u306f\u5186\u8a18\u53f7)<br \/>\n\u3000\u4f8b\u306f\u3001SQL Server Express \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u540d SQLEXPRESS\u306b\u63a5\u7d9a\u3059\u308b\u5834\u5408\u3002<br \/>\n\u3000\u30b5\u30fc\u30d0\u30fc\u30de\u30b7\u30f3\u4e0a\u3067\u52d5\u304b\u3059\u5834\u5408\u3001\u30b5\u30fc\u30d0\u30fc\u306e\u540d\u524d\u306f . \u3067OK\u3089\u3057\u3044\u3002<br \/>\n\u30fbInitial Catalog\uff1a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u540d\u524d\u3002\u305d\u306e\u540d\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\n\u30fbIntegrated Security\uff1a\u8a8d\u8a3c\u306e\u6307\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<br \/>\n\u3000SSPI\u306fWindows\u8a8d\u8a3c\u3067\u63a5\u7d9a\u3059\u308b\u5834\u5408\u306b\u4f7f\u3044\u307e\u3059\u3002true\u3067\u3082\u826f\u3044\u3067\u3059\u3002<br \/>\n\u3000\u30b5\u30fc\u30d0\u30fc\u3068\u5b9f\u884c\u5074\u306e\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u304c\u4e00\u81f4\u3057\u3066\u3044\u308c\u3070\u3001\u4f7f\u7528\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u3000\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u3092\u6307\u5b9a\u3059\u308b\u5834\u5408\u306f\u3001<br \/>\n\u3000Integrated Security = false;User ID=user;Password=pass;<br \/>\n\u3000\u306e\u69d8\u306b\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VB.NET\u304b\u3089SQL\u306b\u63a5\u7d9a\u3059\u308b\u306b\u306f\u3001ADO.NET\u3092\u4f7f\u7528\u3059\u308c\u3070\u826f\u3044\u3089\u3057\u3044\u3002 System.Data.SqlClient.SqlConnection\u30af\u30e9\u30b9\u3092\u4f7f\u3063\u3066\u884c\u3044\u307e\u3059\u3002 Private Con As New Syst [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[27,19,18],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-vbsql","tag-c","tag-sql","tag-vb-net"],"_links":{"self":[{"href":"https:\/\/r-side.net\/index.php?rest_route=\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/r-side.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/r-side.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/r-side.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/r-side.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=91"}],"version-history":[{"count":5,"href":"https:\/\/r-side.net\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":144,"href":"https:\/\/r-side.net\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions\/144"}],"wp:attachment":[{"href":"https:\/\/r-side.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/r-side.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/r-side.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}