Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Typed DataSet and Web Service
Message
From
18/04/2008 14:57:22
 
 
To
18/04/2008 03:08:23
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01311278
Message ID:
01311763
Views:
23
>>>>>
dsDept.DepartmentDataTable dt = new dsDept.DepartmentDataTable(ds.Tables[0]);
>>>>>
>>>>>You are creating a "new" table outside of your dataset, so your dataset will be empty if you fill that table. (The table will have data, but you are returning the dataset, not the table.)
>>>>>
>>>>>
dsDept.DepartmentDataTable dt = ds.DepartmentDataTable;
>>>>>
>>>>>or
>>>>>
>>>>>
adapter.FillByID(ds.DepartmentDataTable, id);
>>>>>
>>>>>HTH
>>>>
>>>>Neither of those is acceptable to the system. When I build I get an error that dsDept.DepartmentDataTable is a 'type' and is not valid in the context.

>>>
>>>Are you sure you went:
>>>
dsDept.DepartmentDataTable dt = ds.DepartmentDataTable;
>>>
>>>Or did you go:
>>>
dsDept.DepartmentDataTable dt = dsDept.DepartmentDataTable;
>>>
>>>Based on your comment you went dsDept.DepartmentDataTable which is a type, ds.DepartmentDataTable is a reference to the table.
>>>
>>>However... everything works as it should, so thanks for the help in putting me on the right track. I was going crazy with this one.
>>>
>>>You're welcome, glad you solved it.
>>
>>I just went back and looked it over again. I typed it as you assumed instead of as you typed because "ds.DepartmentDataTable" was not available. I looked and "DepartmentDataTable" is a private type. That meant I couldn't do it your way without changing the code in a 'generated code' area. In that case, I guess the only way to do it is the way I ended up.
>>
>>Again, thanks for the help.
>
>You're welcome. Strange that it's private on your system. They all come in public on mine. Wonder what would be different.

I think the difference was in my not understanding what I was doing.

The DepartmentDataTable in 'ds' is not "DepartmentDataTable", it's "Department", so the following does work:
dsDept.DepartmentDataTable dt = ds.Department;
and I can replace the 2 lines I used with just that one line. I think I'm finally starting to get the hang of this. Thanks a million.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform