TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Geo
NA
5
0
cannot access dataset.datarow with tableadapter
Oct 22 2010 2:36 PM
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.
Reply
Answers (
4
)
How do I trap zero rows returned from sql statement c#
Teachers code is wrong/ not working will u help me fix it?