This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C3C561.D82B93E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello!
I wonder what is the best way to create a dataset for the table =
structure below and use it with a CheckBoxList.
Table structure
Contacts Events ContactEvents
ContID EventID _ContID
ContName EventName _EventID
=20
Example of data
Contacts Events ContactEvents
230, Elvis Presley 13, Golf 230, 29
234, Bill Clinton 14, Soccer 234, 29
237, Stuart Graham 17, Hockey 234, 28
21, Basket 234, 17
28, Fotball 237, 13
29, Music 237, 14
In example above you can see, that Elvis likes Music. Bill likes Music, =
Fotball and Hockey. Stuart likes Golf and Soccer.
I have a CheckBoxList with all the Events where the user should be able =
to check or uncheck the different events. If I want to add Music event =
to Stuart my save function deletes all rows in ContactEvents with =
_ContID=3D237, return the CheckedItems, and inserts three new rows with =
_ContID=3D237. This doesn't seem to be the best solution. I don't get =
how to do this, and how to write the select query for the dataadapter to =
get all Events (so a commandbuilder can be used). I think I should be =
able to use less code and letting the components do the work?!?! The =
CheckBoxList has the Datasource property (and Displaymember/Valuemeber), =
but I can't find the benifits of using it.
Should I use another component?
Regards Magnus
------=_NextPart_000_0008_01C3C561.D82B93E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hello!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I wonder what is the best way to create =
a dataset=20
for the table structure below and use it with a =
CheckBoxList.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><U>Table structure</U></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2><FONT=20
face=3D"Courier =
New">Contacts =
=20
<FONT=20
size=3D2>Events &nbs=
p;=20
ContactEvents</FONT></FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> =20
ContID &=
nbsp; =20
=
EventID =20
_ContID</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> =20
ContName  =
; =20
EventName =20
_EventID</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> </FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2><U>Example of =
data</U></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>
<DIV><FONT size=3D2><FONT=20
face=3D"Courier =
New">Contacts =
=20
<FONT=20
size=3D2>Events &nbs=
p;=20
ContactEvents</FONT></FONT></FONT></DIV></FONT><FONT face=3D"Courier =
New"=20
size=3D2> 230, Elvis =
Presley 13,=20
Golf 230, =
29</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> 234, Bill=20
Clinton 14,=20
Soccer 234, 29</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> 237, Stuart=20
Graham 17,=20
Hockey 234, 28</FONT></DIV>
<DIV><FONT face=3D"Courier New"=20
size=3D2> &nbs=
p;  =
; 21,=20
Basket 234, 17</FONT></DIV>
<DIV><FONT face=3D"Courier New"=20
size=3D2> &nbs=
p;  =
; =20
28, Fotball 237, 13</FONT></DIV>
<DIV><FONT face=3D"Courier New"=20
size=3D2> &nbs=
p;  =
; =20
29, Music 237, 14</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2><FONT =
face=3DArial></FONT></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>In example above you can see, that =
Elvis likes=20
Music. Bill likes Music, Fotball and Hockey. Stuart likes Golf and=20
Soccer.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have a CheckBoxList with all the =
Events where the=20
user should be able to check or uncheck the different events. If I want =
to add=20
Music event to Stuart my save function deletes all rows in =
ContactEvents=20
with _ContID=3D237, return the CheckedItems, and inserts three new =
rows with=20
_ContID=3D237. This doesn't seem to be the best solution. I don't get =
how to do=20
this, and how to write the select query for the dataadapter to get =
all=20
Events (so a commandbuilder can be used). I think I should be =
able to=20
use less code and letting the components do the work?!?! The =
CheckBoxList has=20
the Datasource property (and Displaymember/Valuemeber), but I can't =
find=20
the benifits of using it.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Should I use another =
component?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Regards =
Magnus</FONT></DIV></BODY></HTML>
------=_NextPart_000_0008_01C3C561.D82B93E0--