Results 1 to 1 of 1

Thread: Error when trying to bind a dataset to a report

  1. #1

    Thread Starter
    Fanatic Member jcavard's Avatar
    Join Date
    Jul 2005
    Location
    Quebec, CANADA
    Posts
    534

    Error when trying to bind a dataset to a report

    Hi! I have a dataset in wich I have all the information relative to an invoice. My problem occurs when I bind the dataset to the report. I get error like "Query Engine Error". The query I use to populate the dataset works fine. Anyway could give me a hint.

    VB Code:
    1. Const strQuery As String = _
    2.                                 "SELECT " & _
    3.                                     "tbl_quotations.date_added, " & _
    4.                                     "tbl_quotations.subtotal,   " & _
    5.                                     "tbl_quotations.tax_1,  " & _
    6.                                     "tbl_quotations.tax_2,  " & _
    7.                                     "tbl_quotations.discount,  " & _
    8.                                     "tbl_quotations.freight,  " & _
    9.                                     "tbl_quotations.total,  " & _
    10.                                     "tbl_quotations.memo, " & _
    11.                                     "tbl_quotation_item.quantity, " & _
    12.                                     "tbl_quotation_item.unit_price, " & _
    13.                                     "tbl_quotation_item.net_price, " & _
    14.                                     "tbl_items.common_name_fr,  " & _
    15.                                     "tbl_items.common_name_en, " & _
    16.                                     "tbl_price.sku, " & _
    17.                                     "tbl_price.format_fr,  " & _
    18.                                     "tbl_price.format_en, " & _
    19.                                     "tbl_family.family_fr,  " & _
    20.                                     "tbl_family.family_en " & _
    21.                                 "FROM tbl_quotations " & _
    22.                                 "INNER JOIN tbl_quotation_item ON tbl_quotations.id_quotation = tbl_quotation_item.id_quotation " & _
    23.                                 "INNER JOIN tbl_items ON tbl_quotation_item.id_item = tbl_items.id_item " & _
    24.                                 "INNER JOIN tbl_price ON tbl_quotation_item.id_price = tbl_price.id_price " & _
    25.                                 "INNER JOIN tbl_family ON tbl_items.id_family = tbl_family.id_family " & _
    26.                                 "WHERE(tbl_quotations.id_quotation = @id_quotation)"
    27.  
    28.         Dim cnn As SqlConnection
    29.         Dim dad As SqlDataAdapter
    30.         Dim dst As DataSet = New dstQuotationPrint
    31.         Dim cmm As SqlCommand
    32.         Dim rpt As New crQuotation
    33.  
    34.         Try
    35.             cnn = New SqlConnection(STR_SQL_CONNECTION_STRING)
    36.             cmm = New SqlCommand(strQuery, cnn)
    37.             dad = New SqlDataAdapter(strQuery, cnn)
    38.             dad.SelectCommand = cmm
    39.  
    40.             cmm.Parameters.Add("@id_quotation", SqlDbType.Int, 4, "id_quotation")
    41.  
    42.             dad.SelectCommand.Parameters("@id_quotation").Value = intNextQuotationID
    43.             dad.Fill(dst, "tbl_quotation")
    44.  
    45.  
    46.             rpt.SetDataSource(dst)
    47.  
    48.  
    49.             list.reportList.ReportSource = rpt
    50.             list.Show()
    51.             list.MdiParent = mainPage
    52.         Catch ex As Exception
    53.             MessageBox.Show(ex.Message)
    54.         Finally
    55.            
    56.         End Try
    Attached Images Attached Images  
    Last edited by jcavard; Sep 13th, 2005 at 10:33 AM.
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    accoustic emo-rock band: a tailormade fable

    Visual Studio 2003 / Framework 1.1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width