protected void getDate()
{
using (SqlConnection conn = new SqlConnection("Data Source=92.1.9.6;Initial Catalog=bbtj;User ID=sbbj;Password=mar"))
{
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT top 5 * FROM t168jd";
conn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
Response.Write("
"+dr.GetString(1));
// Console.WriteLine("{0}t{1}", dr.GetString(0), dr.GetString(1));
}
}
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/790981/viewspace-976006/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/790981/viewspace-976006/