diff --git "a/\351\253\230\351\271\217\350\276\211/ConsoleApp.sln" "b/\351\253\230\351\271\217\350\276\211/ConsoleApp.sln" new file mode 100644 index 0000000000000000000000000000000000000000..2ee3f98465df9c9f2e9c080ed2fc6bda515cf277 --- /dev/null +++ "b/\351\253\230\351\271\217\350\276\211/ConsoleApp.sln" @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30104.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{88B8A369-EBC0-4285-83BD-3CB6D7A78D35}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {88B8A369-EBC0-4285-83BD-3CB6D7A78D35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88B8A369-EBC0-4285-83BD-3CB6D7A78D35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88B8A369-EBC0-4285-83BD-3CB6D7A78D35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88B8A369-EBC0-4285-83BD-3CB6D7A78D35}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5D62350A-0ABA-45A7-ACF4-F32C57DFD105} + EndGlobalSection +EndGlobal diff --git "a/\351\253\230\351\271\217\350\276\211/ConsoleApp/App.config" "b/\351\253\230\351\271\217\350\276\211/ConsoleApp/App.config" new file mode 100644 index 0000000000000000000000000000000000000000..56efbc7b5f15b5166cc89dae0406895b57de0b67 --- /dev/null +++ "b/\351\253\230\351\271\217\350\276\211/ConsoleApp/App.config" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/\351\253\230\351\271\217\350\276\211/ConsoleApp/ConsoleApp.csproj" "b/\351\253\230\351\271\217\350\276\211/ConsoleApp/ConsoleApp.csproj" new file mode 100644 index 0000000000000000000000000000000000000000..1715728203880cc8116a0728fc8d5212b2676903 --- /dev/null +++ "b/\351\253\230\351\271\217\350\276\211/ConsoleApp/ConsoleApp.csproj" @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {88B8A369-EBC0-4285-83BD-3CB6D7A78D35} + Exe + ConsoleApp + ConsoleApp + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\351\253\230\351\271\217\350\276\211/ConsoleApp/Program.cs" "b/\351\253\230\351\271\217\350\276\211/ConsoleApp/Program.cs" new file mode 100644 index 0000000000000000000000000000000000000000..f5ec77ee8ad006ee8f50180337bd8f1a97d957c4 --- /dev/null +++ "b/\351\253\230\351\271\217\350\276\211/ConsoleApp/Program.cs" @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Data.SqlTypes; +using System.Data.SqlClient;/*引用Ado*/ + +namespace ConsoleApp +{ + class Program + { + static void Main(string[] args) + { + string connectionString = "server=.;database=Support;uid=sa;pwd=123456"; + SqlConnection sqlConnection = new SqlConnection(connectionString);/*函数调用*/ + sqlConnection.Open();/*打开到数据库的连接*/ + var sqlcommandString = "select * from Users";/*查询表*/ + SqlCommand sqlCommand = new SqlCommand(sqlcommandString,sqlConnection);/*初始化了一个命令对象,准备执行命令*/ + var sda = sqlCommand.ExecuteReader(); + while (sda.Read()) + { + Console.WriteLine("{0}\t{1}\t{2}\t",sda["Id"],sda["name"],sda["stringId"]);/*打印表格*/ + } + sqlConnection.Close();/*关闭到数据库的连接*/ + } + } +} diff --git "a/\351\253\230\351\271\217\350\276\211/ConsoleApp/Properties/AssemblyInfo.cs" "b/\351\253\230\351\271\217\350\276\211/ConsoleApp/Properties/AssemblyInfo.cs" new file mode 100644 index 0000000000000000000000000000000000000000..9e3bcb3baa561450805f9333292debf614f10f78 --- /dev/null +++ "b/\351\253\230\351\271\217\350\276\211/ConsoleApp/Properties/AssemblyInfo.cs" @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("ConsoleApp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ConsoleApp")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("88b8a369-ebc0-4285-83bd-3cb6d7a78d35")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]