locked
TableAdapter using Parametized Query RRS feed

  • Question

  • I have setup a query in the Tableadapter to look up inventory with a partial description as follows:

     

    SELECT     Item_Id, Description1, Description2, UnitofMeasure, SupplierId1, SupplierId2, SupplierId3, ProductLine_Id, OnHandQty, UnitCost, ReplaceCost,
                          SellPrice, OrderPoint, PkQty, MinQty, MaxQty, EOQ
    FROM         Inventory
    WHERE     (Description1 LIKE @Description1 + N'%')

     

    In the Query Builder this works with no problem and returns the filtered data from the data base.

     

    In the VB Form using the FillbyDescription - I get no data returned - Code below:

     

    Private Sub FillByDescriptionToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FillByDescriptionToolStripButton.Click

    Dim StrChar As String

    StrChar = Description1ToolStripTextBox.Text

    Try

    Me.InventoryTableAdapter.FillByDescription(Me.MaintenanceDataSet.Inventory, StrChar)

    Catch ex As System.Exception

    System.Windows.Forms.MessageBox.Show(ex.Message)

    End Try

    End Sub

     

     

    It is probably simple but I'm missing it

    Any One?

     

    Monday, September 17, 2007 1:46 PM

Answers

  • After a lot of searching, I finally discovered my own answer.  The table definition of the field must be defined as a varchar not as a nchar.

    Tuesday, September 18, 2007 5:33 PM