asp.net 网站测试 DBHelper.cs 提示我查询的列明无效
前台页面 visa.com ;程序页面 nation.aspx.cs ;.bll Td_CountryManager.cs ;
.DAL Td_CountryService.cs ; DBHelper.cs
程序
1 前台页面 visa.com
<ul>
<asp:Repeater ID="Repeatergjc" runat="server">
<ItemTemplate>
<li><p id="qqgj"><a href='nation_<%#Eval("CouEname") %>.html'><%#Eval("CouName") %></a></p><p id="qqprice">¥<%#Eval("CouPrice")%>起</p><div class="clear"></div></li>
</ItemTemplate>
</asp:Repeater>
</ul>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string get = Request.QueryString["id"].ToString();
string[] array = get.Split('_');
string id = array[1];
// 你提交过来的是国家的拼音了,这个地方就不能把收到的编号设置为int格式了,否则肯定是会报错的
cont = Td_CountryManager.GetTd_CountryByCouEname(id);
//签证大区
string sql = string.Format("select * from td_region where countryid={0}", id);
Repeaterdq.DataSource = Td_RegionManager.SelectAllTd_RegionsBySql(sql);
Repeaterdq.DataBind();
//签证类型
string qzzl = "";
sql = string.Format("select visaname from td_visa where visaregionid in(select regionid from td_region where countryid={0})and visatype=1 group by visaname", id);
DataTable table = DBHelper.GetTable(sql);
foreach (DataRow row in table.Rows)
{
qzzl += "<li><p style='width:330px;'>" + row["visaname"].ToString() + daqu(id, row["visaname"].ToString()) + "</p></li>";
}
Literal1.Text = qzzl;
sql = string.Format("select top 10 * from td_question where countryid={0} order by questiontime desc", id);
Repeaterwt.DataSource = Td_QuestionManager.SelectAllTd_QuestionsBySql(sql);
Repeaterwt.DataBind();
sql = "select top 10 * from td_message where messagetype=5 order by messagetime desc";
Repeaterkx.DataSource = Td_MessageManager.SelectAllTd_MessagesBySql(sql);
Repeaterkx.DataBind();
Td_Kword kword = Td_KwordManager.GetTd_KwordByKwordId(2);
public static Td_Country SelectTd_CountryByCouEname(string CouEname)
{
Td_Country info = null;//返回值
string sql = string.Format("SELECT * FROM Td_Country WHERE CouEname like '%s'", CouEname);
IList<Td_Country> list = SelectTd_CountriesBySql(sql);
if (list.Count > 0)
{
info = list[0];
}
return info;
}
public static Td_Country GetTd_CountryByCouEname(string CouEname)
{
return Td_CountryService.SelectTd_CountryByCouEname(CouEname);
}
public static DataTable GetTable(string sql, params SqlParameter[] values)
{
DataTable dt = new DataTable();//返回值
using (SqlConnection conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand(sql, conn);
if (values != null)
{
cmd.Parameters.AddRange(values);
}
SqlDataAdapter da = new SqlDataAdapter(cmd);
conn.Open();
da.Fill(dt);
}
return dt;
}