none
TableAdapterFillBy feature RRS feed

  • Question

  • hi
    i found the below line of code in msdn documentation about tableadapters

    Dim
     tableAdapter As
     New
     NorthwindDataSetTableAdapters.CustomersTableAdapter()
    tableAdapter.FillByCity(NorthwindDataSet.Customers, "Seattle" )
    so i have a dataset at design time and i added to it though a wizard a datatable and tableadapter but now when i write code to fill the
    databale as below the layouttableadapter just show a fill methid it doesnt show a FillByColumName methods si im i missing something ?

            Dim LayoutAdapter As New AlTaybatDataSetTableAdapters.LayoutTableAdapter
            LayoutAdapter.fillbyTableID(AlTaybatDataSet.Current.Layout, "1")
    Wednesday, December 23, 2009 8:03 AM

Answers

  • Hello Ammar,

    Welcome to MSDN forum.

    To enable the FillbyTableID method of a TableAdapter, we need to add a new select statement to the TableAdapter's queries. For example, we can use the following select statement to add a new fill method(I choose Customers table from the NorthWind database).

    "SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM dbo.Customers where City=@city"

    The detailed steps to generate the FillbyCity method.
    1. Open the strong typed dataset in designer
    2. Right-click the TableAdapter -> "Add" -> "Query..."
    3. Select "Use SQL statements" in the TableAdapter Query Configuration Wizard and Click "Next"
    4. Select "Select which returns rows" and Click "Next"
    5. Use the above select statement and Click "Next"
    6. Change the method name to "FillbyCity" and Click "Finish"

    More info
    http://msdn.microsoft.com/en-us/library/ms171902.aspx

    Thanks,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, December 23, 2009 10:48 AM

All replies

  • Hello Ammar,

    Welcome to MSDN forum.

    To enable the FillbyTableID method of a TableAdapter, we need to add a new select statement to the TableAdapter's queries. For example, we can use the following select statement to add a new fill method(I choose Customers table from the NorthWind database).

    "SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM dbo.Customers where City=@city"

    The detailed steps to generate the FillbyCity method.
    1. Open the strong typed dataset in designer
    2. Right-click the TableAdapter -> "Add" -> "Query..."
    3. Select "Use SQL statements" in the TableAdapter Query Configuration Wizard and Click "Next"
    4. Select "Select which returns rows" and Click "Next"
    5. Use the above select statement and Click "Next"
    6. Change the method name to "FillbyCity" and Click "Finish"

    More info
    http://msdn.microsoft.com/en-us/library/ms171902.aspx

    Thanks,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, December 23, 2009 10:48 AM
  • Hello  Ammar,

    How is the situation on your side? Is the issue resolved? If there is any we can help, welcome to post here.

    Regards,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, December 25, 2009 8:28 AM
  • Hi Rong

    yes your answer was perfect thank you
    Wednesday, December 30, 2009 7:16 AM
  • Hello Ammar,

    I am glad that helps. :)

    Regards,
    Rong-Chun Zhang
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, December 30, 2009 7:21 AM