Dynamic Table Adapters?

  • Thread starter Thread starter compyHaX
  • Start date Start date
C

compyHaX

Guest
So, Ive been all over the forums and various sites, including looking at several tutorial videos, and I cant seem to find what Im 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.

Ive been able to create the tables I want and sync them to the DataSet (I think), but Im 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 cant seem to find where its 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();
}

Continue reading...
 
Back
Top