Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Dynamic Table Adapters?

$
0
0

So, I've been all over the forums and various sites, including looking at several tutorial videos, and I can't seem to find what I'm looking for in a simple easy-to-understand format.

Basically, I have an application that creates various profiles, each with a customized layout of columns. I figured that the easiest way to store information in this extremely customizable tables would be to do just that... dynamically create customized tables.

I've been able to create the tables I want and sync them to the DataSet (I think), but I'm having trouble finding a way to read the data on this dynamically created table because the TableAdapters are only existent when you drag a dataSource table onto a windows form.

I realize that I could create a dataAdapter to solve this for me, but every time I try, the program gets to where I attempt to Fill the dataAdapter, and just skips over the code, giving me nothing.

My database is saved as a .mdf file in my project folder, so I think that the application takes care of my connection string behind the scenes. I can't seem to find where it's hidden, nor how to grab the data in an adapter of any sort so I can use it in my form.

So, I guess my question is this... How do I get the information from my dataset, on a custom created table, back into my application to use?

This is how I create the table and add it to the dataset:

{
     DataTable dt = new DataTable("tbl_" + txt_profileName.Text);

     DataColumn[] dc = new DataColumn[1];
     dc[0] = dt.Columns.Add("ID", typeof(Int32));
     dc[0].AutoIncrement = true;

     dt.PrimaryKey = dc;

     dt.Columns.Add("firstName", typeof (string));
     dt.Columns.Add("lastName", typeof (string));

     dt.Rows.Add(0, "Andrew", "Marshall");
     dt.Rows.Add(1, "Rebecca", "Foster");

     this.tuckshopProDataSet.Tables.Add(dt);
     this.Validate();
}


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>