I rarely post and I am fairly new to C# and programming in general, but I am having an odd problem that I cannot for the life of me figure out. I have a very simple test database with one table that contains two records. It has two fields one primary key that auto increments and one field of type nvarchar(50). I add the dataset using the wizard (many times and other ways too). I have selected my tables and they show up in the designer. Here is the code from Main:
testDataSetTableAdapters.testTableAdapter tta = new testDataSetTableAdapters.testTableAdapter();
testDataSet tds = new testDataSet();
tta.Fill(tds.test);
//Here is where the problem is - when I try to access the row to get a new row "testRow" is not available from
//intellisense as it seems that it should be:
tds.testRow // - This is not available
//Therefore I cannot create a new row to insert. Fill, Update, etc are there and working. The "test" table is there but not testRow.
If I remove the tds.testRow the application runs and in debug mode I can view the table and see the data in it, so I know that the fill statement is working correctly. I have run essentially the exact same code on another computer without any problems. This computer is a Windows Vista 64 bit computer running VS2010 Express. I tried setting the CPU setting to Any CPU as this sometimes cures some problems on the 64 bit computer. I have looked everywhere for a solution. One thing that seemed odd to me is that the "testRow" exist does exist in the dataSet. If I type:
ConsoleApplication1.testDataSet.testRow //Intellisense recognizes this. so the command is there. It just does not show
up for my "tds". Any help or suggestions you can provide are greatly appreciated.
Loading
Sam HobbsPosted Oct 22, 2010, 11:36 PM
GeoPosted Oct 23, 2010, 10:54 AM
GeoPosted Oct 22, 2010, 10:50 PM
testDataSetTableAdapters.testTableAdapter tta = new testDataSetTableAdapters.testTableAdapter();
testDataSet tds = new testDataSet();
tta.Fill(tds.test);
tds.testRow //This does not work
testDataSet.testRow newTestRow = tds.test.NewtestRow(); //This does work
Please excuse the lack of proper usage of Upper/Lower case letters in this example, I will do better next time.
Thanks again for the comment and help.
Sam HobbsPosted Oct 22, 2010, 5:52 PM
I don't know what testRow is. I am not as familiar with TableAdapters as I want to be but as best as I can remember datasets don't have a member called that and customized names for row instances are not generated. Perhaps testRow is a class, not a member; is that possible? That is the type of thing that could confuse me. It is frustrating that tools such as the class view and the object explorer are good for finding definitions in the sense of classes but not declarations in the sense of instances of classes.