Note that there are some explanatory texts on larger screens.

plurals
  1. POIncorrect syntax near ')'. Incorrect syntax near the keyword 'on'
    primarykey
    data
    text
    <p>I am new to VB.NET. I'm trying to add a table to an ASPX page. But I get the above error with the following code. Can you tell what I am doing wrong? I want many table rows returned; one for each product, where first cell = product name, cell 2 = NumOpen, and cell 3 = 95%.</p> <pre><code>&lt;HTML&gt; &lt;SCRIPT LANGUAGE="VB" RUNAT="Server"&gt; Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) If Not IsPostBack Then Dim YearDate As Date = "1/1/05" Dim arrYear As New ArrayList() While YearDate &lt;= Today arrYear.Add(YearDate.ToString("yyyy")) YearDate = YearDate.AddYears(1) End While dYear.DataSource = arrYear dYear.DataBind() dYear.SelectedValue = Today.AddMonths(-1).ToString("yyyy") Dim ListMonth As Date = "1/1/08" Dim arrListMonth As New ArrayList() While ListMonth &lt;= "12/1/08" arrListMonth.Add(ListMonth.ToString("MMM")) ListMonth = ListMonth.AddMonths(1) End While dEndMonth.DataSource = arrListMonth dEndMonth.DataBind() dEndMonth.SelectedValue = Today.AddMonths(-1).ToString("MMM") Else End If Main() End Sub Sub Main() Dim FirstMonthDate As Date = CDate(dYear.SelectedValue &amp; "-" &amp; dEndMonth.SelectedValue &amp; "-1") FirstMonthDate = FirstMonthDate.AddMonths(-2) Dim LastMonthDate As Date = GlobalFunctions.GlobalF.MonthLastDate(dYear.SelectedValue &amp; "-" &amp; dEndMonth.SelectedValue &amp; "-1") Dim arrMonths As New ArrayList() While FirstMonthDate &lt;= LastMonthDate arrMonths.Add(GlobalFunctions.GlobalF.MonthLastDate(FirstMonthDate).ToString) FirstMonthDate = FirstMonthDate.AddMonths(1) End While Dim monthString As String Dim ProductList As String = "SELECT DISTINCT PRODUCT FROM EXCEL.DMR_PRODUCT" Dim ProductListData As New System.Data.DataSet ProductListData = GlobalFunctions.GlobalF.GetDevSQLServerDataSet(ProductList) Dim ProductRow As DataRow Dim y As Integer = 0 Dim arrayProducts() As String Dim ProductTableRow As New HtmlTableRow Dim ProductTableCell As New HtmlTableCell ProductTableCell.InnerText = "Products" ProductTableRow.Cells.Add(ProductTableCell) ProductTableCell.Attributes.Add("class", "HeaderRow") Dim NumOpenCell As New HtmlTableCell NumOpenCell.InnerText = "Number Open" ProductTableRow.Cells.Add(NumOpenCell) NumOpenCell.Attributes.Add("class", "HeaderRow") NumOpenCell.Width = 100 Dim ComplaintCell As New HtmlTableCell ComplaintCell.InnerText = "% Of Open Complaints Complaints &lt; 90 Days - Rolling 3 Month" ProductTableRow.Cells.Add(ComplaintCell) ComplaintCell.Attributes.Add("class", "HeaderRow") ComplaintCell.Width = 100 Dim NumOpenList As String table1.Rows.Add(ProductTableRow) For Each ProductRow In ProductListData.Tables(0).Rows For Each monthString In arrMonths Next ReDim Preserve arrayProducts(y) arrayProducts(y) = ProductRow("PRODUCT") ProductTableRow = New HtmlTableRow ProductTableCell = New HtmlTableCell ProductTableCell.InnerText = arrayProducts(y) ProductTableRow.Cells.Add(ProductTableCell) NumOpenList = "SELECT COUNT([FORMAT NUMBER]) " &amp; _ "FROM(ALL_COMPLAINTS) " &amp; _ " join (SELECT * FROM dbo.ProductPartNumbers(' " &amp; _ arrayProducts(y) &amp; _ " ')) on EPA_PRD_CODE like '%' + [FORMAT NUMBER] + '%' " Dim NumOpenListData As New System.Data.DataSet NumOpenListData = GlobalFunctions.GlobalF.GetDevSQLServerDataSet(NumOpenList) NumOpenCell = New HtmlTableCell NumOpenCell.InnerText = NumOpenList ProductTableRow.Cells.Add(NumOpenCell) ComplaintCell = New HtmlTableCell ComplaintCell.InnerText = "95%" ProductTableRow.Cells.Add(ComplaintCell) table1.Rows.Add(ProductTableRow) y = y + 1 Next End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload