none
Data Adapter Configuration Wizard RRS feed

  • Question

  • when i use the wizard to create the dataset the fill() method does not work and result in null dataset
    this is the code, the myds is the name of the data set the fill method is the default method created by the wizard
    i tried many senario but all give the same result (null data set)
    i tried the insert method created by wizard it worked with out prolems
    any one can help
    i want to use only the dataset wizard
    all is the name of the table
    myds is the name of dataset
    allTableAdapter d1 = new mydsTableAdapters.allTableAdapter();
    myds.allDataTable x = new myds.allDataTable();
    d1.Filla(x);
    //the result of x.Dataset is null

     

    Wednesday, June 1, 2011 5:30 AM

Answers

  • yes but what i wanted to know is that i must use the two methode not one of them like this

    the getdata() and the fill() which i didnt know from the beginning

     

    DS2 ds = new DS2();

    DS2TableAdapters.

     

    allTableAdapter da1 = new DS2TableAdapters.allTableAdapter();

    da1.GetData();

     

    da1.Adapter.Fill(ds);

    every thing worked fine thank any way.


    prutal
    Wednesday, June 8, 2011 1:13 PM

All replies

  • Hi,

    x here is your strongly named DataTable class. It does not belong to a DataSet.

    So after the operation d1.Fill(x); x will hold the data.

    Try binding x to a DataGridView

    dataGridView1.DataSource = x;
    


    Please mark this as answer or vote as helpful if it solved your problem
    Wednesday, June 1, 2011 7:19 PM
  • As it is a typed dataset "myds" is a dataset type. You need to instantiate it and fill its table.

    myds ds=new myds();

    d1.Fill(ds. all);

    myds.allDataTable x =ds.all;

    Typed datasets provides access of the dataset elements in a typed way which is obliged to a schema versus generalized access of the ado.net objects. The types are defined, so we need to create instance of those types.

    If it is to bind a control you could straight away use the datatable itself.

    Also make sure the table adapter works fine, because in some cases the table adapters won't work fine when multiple tables in your dataset and also defined relationships. In that case use the general DataAdapter classes.

    Good Luck

     

     

     

    Wednesday, June 1, 2011 7:50 PM
  • Hi Prutal,

    Thanks for your post.

    I am writing here to check the status of your issue, is it resolved? If you have any update, please feel free to let me know.

     

    Good day,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 8, 2011 7:33 AM
    Moderator
  • yes but what i wanted to know is that i must use the two methode not one of them like this

    the getdata() and the fill() which i didnt know from the beginning

     

    DS2 ds = new DS2();

    DS2TableAdapters.

     

    allTableAdapter da1 = new DS2TableAdapters.allTableAdapter();

    da1.GetData();

     

    da1.Adapter.Fill(ds);

    every thing worked fine thank any way.


    prutal
    Wednesday, June 8, 2011 1:13 PM