VB.NET - TableAdapter Parameter error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kalas
    New Member
    • Sep 2008
    • 6

    VB.NET - TableAdapter Parameter error

    his SQL statement is used on the table adapter for the datagridview1

    SELECT Descrição, idEncomendado, Estado, NºSerie, Actualização, NumEnc
    FROM Table_1Encomend ados
    WHERE NumEnc = @idEnc

    but then i get this error

    Error 1 Argument not specified for parameter 'idEnc' of 'Friend Overridable Overloads Function Fill(dataTable As demoDataSet2.Ta ble_1Encomendad osDataTable, idEnc As String) As Integer'. C:\Documents and Settings\bruno. amorim\Os meus documentos\Visu al Studio 2005\Projects\W indowsApplicati on1\WindowsAppl ication1\frmMai n.vb 67 9 WindowsApplicat ion1

    on the line

    Me.Table_1Encom endadosTableAda pter.Fill(Me.De moDataSet2.Tabl e_1Encomendados )


    idEnc is declared in a module as Friend integer

    How is it possible to see the "Preview query" on the datagridview working but, whem you go to the code this error appears?
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Well, where have you defined your parameter at?

    The preview query probably pops up a window for you to give the parameter a value, but that won't work in the application.

    Comment

    • kalas
      New Member
      • Sep 2008
      • 6

      #3
      the var IdEnc is defined in a Module as Friend Integer

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        Originally posted by kalas
        the var IdEnc is defined in a Module as Friend Integer

        Right, but where have you actually defined the parameter? You can't just define a variable that has the same name and expect it to be the parameter.

        Comment

        • kalas
          New Member
          • Sep 2008
          • 6

          #5
          Originally posted by insertAlias
          Right, but where have you actually defined the parameter? You can't just define a variable that has the same name and expect it to be the parameter.

          Then i guess , i didnt defined the parameter, can you help me out?

          Comment

          • Curtis Rutland
            Recognized Expert Specialist
            • Apr 2008
            • 3264

            #6
            Originally posted by kalas
            Then i guess , i didnt defined the parameter, can you help me out?
            Post the relevant parts of your code, I'll see what I can do.

            Comment

            • kalas
              New Member
              • Sep 2008
              • 6

              #7
              this part is where the var idEnc gets a value

              Code:
                      Try
                          idEnc = Dgv_Table1t.CurrentRow.Cells("IdEncomendaDataGridViewTextBoxColumn").Value
                          Cliente = Dgv_Table1t.CurrentRow.Cells(2).Value
                          Label1.Text = idEnc
                          Label2.Text = Dgv_Table1t.CurrentRow.Index
              
                      Catch ex As Exception
                          Dgv_Table1t.Select()
                      End Try
              this is used to Fill data into the datagridview

              Comment

              • kalas
                New Member
                • Sep 2008
                • 6

                #8
                a parameter cant be declared this way?

                Friend update() As Integer = {"@idEnc"}

                Comment

                • kalas
                  New Member
                  • Sep 2008
                  • 6

                  #9
                  Thank you but,

                  it doesn't work as i wanted, but i think my point is pretty simple and i dint explained myself right

                  I load dataset1 into a datagridview on form1, when the program starts in form 1 , user selects one row of the table and from that selection i extract one integer value from a certain column . (example: user selected line 1 and idEnc gets value 4)

                  that value is then (in a Friend integer var) used to fill datagridview2 in form2 with other table WHERE some column in that table equals idEnc.

                  I use the value form idEnc to be displayed in some labels in form2.

                  Dont know if this can be done exactly in the way i explained
                  Post is abusive

                  Comment

                  Working...