none
Populate Texboxes with TableAdapter Query RRS feed

  • Question

  • Hi

    Im getting ok ok with datasets, tableadapters and the like but i have come across something i cannot resolve.

    I have a small amount of queries in a TableAdapter and these queries populate ok with the GetBy query based on a text box value to populate a datagrid view. The data is correctly returned on a datagrid.

    One of my queries (GetByRecordID) has 3 additional tables with the PK fields correctly linked. When i preview data, i get the correct result.

    The Fields count in the GetByRecordID query is greater than in the table that the adapter is connected too so, when i go to the DataSource tab and drag in the fields from the correct dataset, i cannot see the additional fields from the query.

    How can i get the fields from the query into the text boxes on the form? when i call the line to FillBy, i get an error

    Thanks

    Nigel


    Nacho is the derivative of Nigel "True fact!"

    • Moved by Youjun Tang Tuesday, March 10, 2015 2:47 AM more related to the suggested forum
    • Moved by Fei XueMicrosoft employee Tuesday, March 10, 2015 2:56 AM VB issue
    • Moved by Youjun Tang Tuesday, March 10, 2015 6:35 AM more related to the suggested forum
    Sunday, March 8, 2015 11:20 PM

Answers

  • Hi

    I have a pretty good level of database design seeing as i used to program & manage Access database for a number of years. I even used to build developer tools for access. The database doesnt require any specific relationships as its a single table result. The only relations i have & need are the reference objects that i relate inside the query.

    I got around this by creating the query View in the Database object outside of VS and then i added it to the dataset. That allowed me to treat it as one table inside VS and i can now drag all the fields i need onto my form. The only thing i do inside VS is to add a parameter filter to the RecordID

    Thanks for your help though :)

    Nige


    Nacho is the derivative of Nigel "True fact!"

    Wednesday, March 11, 2015 12:32 PM

All replies

  • Hi NachoShaw,

    As your issue is related to Ado.net , I would help to move it to DataSet forum for supports, thanks for your understanding.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=adodotnetdataset

    Best regards,
    Youjun Tang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    • Edited by Youjun Tang Tuesday, March 10, 2015 6:36 AM
    Tuesday, March 10, 2015 2:46 AM
  • Hello Nigel,

    >>The Fields count in the GetByRecordID query is greater than in the table that the adapter is connected…

    It is not very clear to understand the scenario you described, if possible, could you please provide some code and photos which could help us understand it?

    >> when i call the line to FillBy, i get an error

    Please provide the detail message information about this error.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 10, 2015 8:36 AM
    Moderator
  • Hi

    Here is a visual description of my problem. My Table "tbl_5_Records" has 13 records. I added a query to the adapter and linked 4 additional tables to it and connected them via the ID's for the related tables. This provided more than 13 fields in the query and its these fields that i need to bind to my controls.

    When i try and add a binding source to a control or drag a dataset object in from the bar, the extra fields from the query are not available. How can i add the additional fields from the query to the controls on the form?

    Thanks

    Nigel


    Nacho is the derivative of Nigel "True fact!"

    Tuesday, March 10, 2015 10:14 AM
  • Hello Nigel,

    This is by designed that the data source would only show properties belongs to the dataadapter, for what you want, I suggest that you could add an additional specific adapter which contains four tables, it then would generate an entity contains all columns you selected.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 11, 2015 7:58 AM
    Moderator
  • Hello Nigel,

    I see not any relation in your data.

    Try to get on a better level of Database design and put those in your SQL Designer.

    The tableAdapter and especially the TableAdapterManager will use those.


    Success
    Cor

    Wednesday, March 11, 2015 12:22 PM
  • Hi

    I have a pretty good level of database design seeing as i used to program & manage Access database for a number of years. I even used to build developer tools for access. The database doesnt require any specific relationships as its a single table result. The only relations i have & need are the reference objects that i relate inside the query.

    I got around this by creating the query View in the Database object outside of VS and then i added it to the dataset. That allowed me to treat it as one table inside VS and i can now drag all the fields i need onto my form. The only thing i do inside VS is to add a parameter filter to the RecordID

    Thanks for your help though :)

    Nige


    Nacho is the derivative of Nigel "True fact!"

    Wednesday, March 11, 2015 12:32 PM