locked
Tableadapter query configuration wizard RRS feed

  • Question

  • Hi I am new to vb express. I have added the the following SQL statement to the tableadapter query wizard and called the method from code.This works fine and the form displays any records with the lastname "jones". How do I change this so I can select records from the dataset based on a form variable. Eg I would like to select records from the database based upon the textbox.text.

    Sql Statement used in wizard

    SELECT     customerid, firstname, lastname
    FROM         data
    WHERE     (lastname = 'jones ')

    method:

    Me.DataTableAdapter.FillBy(Database1DataSet.data)

     

    Saturday, January 14, 2006 10:52 PM

Answers

  • Many Thanks E10T

    I used the @ in the sql statement within the wizard and it worked fine.

    But after some consideration I'am goining to create my SQL statements

    within my code for now.

    Monday, January 16, 2006 9:41 PM

All replies

  • My tableadapter filby query is:

     SELECT Extension, Description FROM dbo.Extensions where Extension = @Extension

    I run the query by:

    Private Function ExtensionDescription(ByVal Extension As String) As String

    Dim ta As New tenPBXdbDataSetTableAdapters.ExtensionsTableAdapter

    Dim dt As New tenPBXdbDataSet.ExtensionsDataTable

    ta.FillByExtension(dt, Extension)

    Return dt(0).Description

    End Function

    Sunday, January 15, 2006 3:30 PM
  • Many Thanks E10T

    I used the @ in the sql statement within the wizard and it worked fine.

    But after some consideration I'am goining to create my SQL statements

    within my code for now.

    Monday, January 16, 2006 9:41 PM