搜索问题,大家帮帮忙!
程序没有报错,可是搜索出来的结果是空的,各位帮帮忙看看,小弟初学,就剩这么些分了,谢谢!
.aspx文件
<asp:GridView ID="gvrcsearch" runat="server" AutoGenerateColumns="False" BackColor="#FEFBF4"
GridLines="None" ShowHeader="False" Width="100%" DataKeyNames="ResumeID" OnRowDataBound="gvrcsearch_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:GridView ID="gvdinfo" runat="server" Width="100%" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table style="width: 100%">
<tr>
<td align="left" colspan="4" style="width: 100%">
<a href='djob.aspx?id=<%# DataBinder.Eval(Container.DataItem,"jcomID")%>'>
<%# DataBinder.Eval(Container.DataItem, "PName")%>
</a> </td>
</tr>
<tr>
<td style="width: 25%">
学历:</td>
<td style="width: 25%">
<%# DataBinder.Eval(Container.DataItem, "pxl")%> </td>
<td style="width: 25%">专业:</td>
<td style="width: 25%">
<%# DataBinder.Eval(Container.DataItem, "pzy")%> </td>
</tr>
<tr>
<td style="width: 25%">性别:</td>
<td style="width: 25%"><%# DataBinder.Eval(Container.DataItem, "PSex")%> </td>
<td style="width: 25%">月薪:</td>
<td style="width: 25%"><%# DataBinder.Eval(Container.DataItem, "Pay")%> </td>
</tr>
<tr>
<td style="width: 25%">地点:</td>
<td colspan="3" style="width: 75%"><%# DataBinder.Eval(Container.DataItem, "pAddress")%> </td>
</tr>
<tr>
<td colspan="4" style="width: 100%; height: 1px; background-color: red;"> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
.cs文件
public partial class job_zp_rcsearch : System.Web.UI.Page
{
DataBase db = new DataBase();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.GetResuem();
}
}
public void GetResuem()
{
string city= Request.Cookies["city"].Value;
string xueli= Request.Cookies["xueli"].Value;
string zye= Request.Cookies["zye"].Value;
string 易做图= Request.Cookies["易做图"].Value;
string pay= Request.Cookies["pay"].Value;
string keyword= Request.Cookies["key"].Value;
//string position = Request.Cookies["position"].Value;
string sql = "SELECT sysresume.ResumeID FROM sysresume INNER JOIN syspersoninfo ON sysresume.ResumeID = syspersoninfo.ResumeID INNER JOIN sysintentexper ON sysresume.ResumeID = sysintentexper.ResumeID INNER JOIN syseduexper ON sysresume.ResumeID = syseduexper.ResumeID WHERE (syspersoninfo.pxl = '" + xueli + "') AND (syspersoninfo.pzy = '" + zye + "') AND (syspersoninfo.PSex = '" + 易做图 + "') AND (syspersoninfo.pAddress like '%" + city + "%') AND (sysintentexper.Pay = '" + pay + "')or (syspersoninfo.PName like '%" + keyword + "%')";
this.gvrcsearch.DataSource = db.ExReader(sql);
this.gvrcsearch.DataBind();
}
protected void gvrcsearch_RowDataBound(object sender, GridViewRowEventArgs e)
{
string id = this.gvrcsearch.DataKeys[e.Row.RowIndex].Value.ToString();
string sql = "SELECT syseduexper.SpeDetailName, syseduexper.EducationValue, syspersoninfo.PName, syspersoninfo.PSex, sysintentexper.Address, sysintentexper.Pay, sysresume.ResumeID FROM sysresume INNER JOIN syseduexper ON sysresume.ResumeID = syseduexper.ResumeID INNER JOIN syspersoninfo ON sysresume.ResumeID = syspersoninfo.ResumeID INNER JOIN sysintentexper ON sysresume.ResumeID = sysintentexper.ResumeID WHERE (sysresume.ResumeID = '" + id + "')";
GridView gvinfo = (GridView)e.Row.FindControl("gvdinfo");
gvinfo.DataSource = db.ExReader(sql);
gvinfo.DataBind();
}
}
--------------------编程问答-------------------- 把SQL语句拷到查询分析器里,将一些变量用一些数据代替,看看能不能搜索记录
如果代码不错,一般是不仔细。楼主仔细一点。 --------------------编程问答-------------------- 先检查sql语句,如果运行的sql语句没错,你就设置断点方式检查 --------------------编程问答-------------------- 断点
追踪
把SQL语句拷出来
在查询分析器里执行
看结果
分析 --------------------编程问答-------------------- 断点调试追踪 --------------------编程问答-------------------- 用断点调试看返回值正确性
补充:.NET技术 , ASP.NET