Class/Citys.cs
(完整代码) 1KBusing System;
using System.Data.SqlClient;
using System.Data;
using AirQuery.entity;
//该源码下载自www.51aspx.com(51aspx.com)
namespace AirQuery.Class
{
/// <summary>
/// Citys 的摘要说明。
/// </summary>
public class Citys
{
public Citys()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public CityData GetAllCity()
{
SqlConnection sqlConnection = new SqlConnection();
sqlConnection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];//"server=localhost;uid=sa;pwd=;database=AirQuery;";
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
SqlCommand sqlCommand = new SqlCommand();
sqlDataAdapter.SelectCommand = sqlCommand;
sqlCommand.CommandText = "SelectCity";
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.Connection = sqlConnection;
CityData city = new CityData();
try
{
sqlConnection.Open();
sqlDataAdapter.Fill(city.City);
}
catch(Exception e)
{
throw new ApplicationException("数据库访问错误。", e);
}
finally
{
sqlConnection.Close();
}
return city;
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
