简体   繁体   English

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

[英]Some issue while displaying the records in table in asp.net

Through query I am fetching all the required records from database but all the records are not displaying in the display table.I am not able to find out why all the records are not displaying. 通过查询,我从数据库中获取了所有必需的记录,但是所有记录都没有显示在显示表中。我无法找出为什么所有记录都没有显示的原因。 For eg: if I am fetching 6 records, then only 3 records are displayed.(odd records are displayed ie;1st, 3rd and 5th records are displayed). 例如:如果我要获取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);
                }

            }
        }

Does chbStatuslist.Items.Count have the expected number? chbStatuslist.Items.Count是否具有预期的数量?

Does dTable.Rows.Count have the expected number? dTable.Rows.Count是否具有预期的数量?

If you set a breakpoint for each dTable.Rows[ni]["cpNo"].ToString(); 如果为每个dTable.Rows[ni]["cpNo"].ToString();设置一个断点dTable.Rows[ni]["cpNo"].ToString(); do you see the ones you expect? 您看到期望的了吗?

Are you getting any javascript errors? 您收到任何JavaScript错误吗?

Can you look at the request going back to the browser (eg CTRL + SHIFT + I in chrome, then network tab) and see the expected data being sent? 您能否查看返回到浏览器的请求(例如chrome中的CTRL + SHIFT + I ,然后单击“网络”选项卡),并查看发送的预期数据?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM