sqlDataAdapters/

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using sql server, and in my database there two tables. One of the tables
is the primary (tasks) and the other is secondary (Detail). The primary keys
in both tables is "services-order-number". The 'Detail table' also has
aother key "taskid". They look fine in the sql database, but when I generate
a dataset using these tables the keys in the detail table do not show up.
Please help!!


task-details

3 [service-order-number] int 4 0
2 taskid int 4 0
0 [task-desc] char 25 0
0 [complete-date] smalldatetime 4 0
0 [task-cost] money 8 0
0 [time-stamp] datetime 8 0

Task


3 [service-order-number] int 4 0
0 [task-date] smalldatetime 4 0
0 [animal-id] int 4 0
0 [owner-id] int 4 0
0 [animal-name] char 15 0
0 [owner-fname] char 15 0
0 [owner-lname] char 15 0
0 [service-status] char 10 0
0 animalsize char 7 0
0 filler char 10 1
0 [time-stamp] datetime 8 0


<xs:element name="task" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType>
<xs:sequence>
<xs:element name="service-order-number" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" />
<xs:element name="task-date" type="xs:dateTime" />
<xs:element name="animal-id" type="xs:int" />
<xs:element name="owner-id" type="xs:int" />
<xs:element name="animal-name" type="xs:string" />
<xs:element name="owner-fname" type="xs:string" />
<xs:element name="owner-lname" type="xs:string" />
<xs:element name="service-status" type="xs:string" />
<xs:element name="animalsize" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element><xs:element name="task-details"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType>
<xs:sequence>
<xs:element name="service-order-number" type="xs:int" />
<xs:element name="taskid" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" />
<xs:element name="task-desc" type="xs:string" />
<xs:element name="complete-date" type="xs:dateTime" />
<xs:element name="task-cost" type="xs:decimal" />
</xs:sequence>
</xs:complexType>
</xs:element>
 
Norm,

The tables retrieved by a dataadapter show up in your dataset in the way you
have selected them using a select statement.

Therefore, what do those for both tables look like?

Cor
 
Thanks Cor, I am not sure that I understand what you mean. But this is what
I do.
I have a Windows form and from the tools menu I select the sqlDataAdapter
and place it on the form. I next select the table to use, and use query
builder to complete the data adapter. Next generate the dataset, and that is
where the problem turns up. One table is fine but the other does not
have/display the key info.

In the sql data table they appear to be ok.

Norm
 
Nbohana,

You should have done those steps two times for each table apart.

Did you do that?

Cor
 
Hi Cor, I did each table as you say. I just got a message as follows:
"System.ArgumentException: Cannot create a child list field tasktask-details"
This is the name assigned to the relationship in the dataset schema.

The code line that crashed : cmTaskDetails = (CurrencyManager)
this.BindingContext[dsTasks2, "tasktask-details"];


i.e: System.ArgumentException: Cannot create a child list for field
tasktask-details.
at System.Windows.Forms.BindingContext.EnsureListManager(Object
dataSource, String dataMember)
at System.Windows.Forms.BindingContext.get_Item(Object dataSource, String
dataMember)
at Owner.ServiceTask.ServiceTask_Load(Object sender, EventArgs e) in
e:\kennel\owner-info\owner-info\servicetask.cs:line 685
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
 
Nbohana,

In my opinion is this a complete different questions than we started with.
I am glad that you succeeded to pass that point of your original message.

I think that it is better that you for this question make a new question
with a description of the problem. Than I understand it better and you can
get more answers from other people.

Cor
 
Back
Top