gpt4 book ai didi

mysql - 在 asp.net 中显示表中的记录时出现一些问题

转载 作者:行者123 更新时间:2023-11-29 00:21:19 25 4
gpt4 key购买 nike

通过查询,我正在从数据库中获取所有需要的记录,但所有记录都没有显示在显示表中。我无法找出为什么所有记录都没有显示。例如:如果我要获取 6 条记录,则只显示 3 条记录。(显示奇数记录,即显示第 1、3 和 5 条记录)。

for (j = 0; j < chbStatuslist.Items.Count; j++)
{
if (chbStatuslist.Items[j].Selected)
{
carrStatus = chbStatuslist.Items[j].Value.Split('.');
if (carrStatus.Length == 2)
{
dTable = getConn.GetAdapterDatatable("SELECT cpCode, cpDate, cpNo,csShortName,pjName, cpComplaint, cpMobile, cpSev, cpCompBy, cpStatus FROM complaint,customermaster,project WHERE cpDel='R' and cpCustomer=csCode and cpProject=pjCode and (cpCustomer='" + cmbCustomer.SelectedValue + "' or 'ALL'='" + cmbCustomer.SelectedValue + "') and cpSev='" + cmbSev.SelectedItem + "' and cpDate between '" + cFDate + "' and '" + cTDate + "' and cpStatus>='" + carrStatus[0] + "' and cpStatus<='" + carrStatus[1] + "' Order by cpNo ", Global.conStrDatabase);
}
else if (carrStatus.Length == 1)
{
dTable = getConn.GetAdapterDatatable("SELECT cpCode, cpDate, cpNo,csShortName,pjName, cpComplaint, cpMobile, cpSev, cpCompBy, cpStatus FROM complaint,customermaster,project WHERE cpDel='R' and cpCustomer=csCode and cpProject=pjCode and (cpCustomer='" + cmbCustomer.SelectedValue + "' or 'ALL'='" + cmbCustomer.SelectedValue + "') and cpSev='" + cmbSev.SelectedItem + "' and cpDate between '" + cFDate + "' and '" + cTDate + "' and cpStatus='" + carrStatus[0] + "' Order by cpNo ", Global.conStrDatabase);
}
for (int ni = 0; ni < dTable.Rows.Count; ni++)
{
tRow = new TableRow();

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

tCell = new TableCell();
tRow.Cells.Add(tCell);

if (dTable.Rows[ni]["cpDate"].ToString() != "")
{
tRow.Cells[0].Text = DateTime.Parse(dTable.Rows[ni]["cpDate"].ToString()).ToString("dd/MM/yyyy");
}
tRow.Cells[1].Text = dTable.Rows[ni]["cpNo"].ToString();
tRow.Cells[2].Text = dTable.Rows[ni]["cpComplaint"].ToString();
tRow.Cells[3].Text = dTable.Rows[ni]["cpMobile"].ToString();
tRow.Cells[4].Text = dTable.Rows[ni]["cpCompBy"].ToString();
tRow.Cells[5].Text = dTable.Rows[ni]["csShortName"].ToString();
tRow.Cells[6].Text = dTable.Rows[ni]["pjName"].ToString();
tRow.Cells[7].Text = dTable.Rows[ni]["cpSev"].ToString();
tRow.Cells[8].Text = dTable.Rows[ni]["cpStatus"].ToString();
tRow.Cells[9].Text = "<a href='../Reports/rptComplaint.aspx?CId=WD" + dTable.Rows[ni]["cpCode"].ToString() + "&RequestId=" + cRequestId + "&FromDate=" + cFDate + " > View </a>";
dispTable.Rows.Add(tRow);
}

}
}

最佳答案

chbStatuslist.Items.Count 是否有预期的数量?

dTable.Rows.Count 是否有预期的数量?

如果您为每个 dTable.Rows[ni]["cpNo"].ToString(); 设置一个断点,您会看到您期望的断点吗?

您是否收到任何 javascript 错误?

你能看看返回到浏览器的请求吗(例如 CTRL+SHIFT+I 在 chrome 中,然后是网络选项卡)和看到正在发送的预期数据了吗?

关于mysql - 在 asp.net 中显示表中的记录时出现一些问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20964939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com