using System;
using System.Data.SqlClient;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
SqlConnection con = new SqlConnection("server=.\\sqlexpress;uid=sa;pwd=123456;database=stuDB");
con.Open();
SqlCommand com = con.CreateCommand();
com.CommandText = "select * from stuInfo";
SqlDataReader reader = com.ExecuteReader();
while (reader.Read())
Console.WriteLine(reader["stuName"].ToString() + reader["stuAge"].ToString() + reader["stuSex"].ToString());
reader.Close();
con.Close();
Console.Read();
}
}
}
转载于:https://www.cnblogs.com/tiandsp/p/7440432.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)