• Aaaargh! Case sensitivity in databases!

    Aaaargh! Case sensitivity in databases! Hoe is dat in godsnaam mogelijk?!

    We zijn juist terug van bij mijn moeder (mijn vader zat weer ergens ginderachter, Ljubjana deze keer, tsss), en ik dacht, I’ll give this datab binding lark another go.

    En what do you know? Het is onnoemelijk onnoemelijk veel gemakkelijker dan ik dacht. Gegeven een combobox cbPublisher voor een lijst uitgevers, een datatable tblBook waarin het huidige boek zit en een datatable tblPublishers met alle uitgevers:

    //de combobox een datasource geven
    cbPublisher.DataSource=tblPublishers;

    //displaymember van een combobox met datasource is wat getoond wordt
    cbPublisher.DisplayMember=”publisher_name”;

    //daarmee overeenkomend: valuemember, ’t zelfde als value in een (html-)<option>
    cbPublisher.ValueMember=”publisher_ID”;

    //hey presto! selectedvalue verbinden met book_publisher_id uit tblBook
    cbPublisher.DataBindings.Add(“SelectedValue”, tblBook, “book_publisher_ID”);

    En dat is het. Dat is àlles! Werkt direkt van de eerste keer, werkt perfect, doet wat het moet doen, prachtig. Sweet Jesus!

    Enfin ja, alles, een groot woord. Ik heb dan nog een goeie drie kwartier zitten zoeken waarom het niet wou werken als ik er een tweede combobox aan toe wou voegen:

    cbCover.DataSource=tblCovers;
    cbCover.DisplayMember=”cover_type”;
    cbCover.ValueMember=”cover_ID”;
    cbCover.DataBindings.Add(“SelectedValue”, tblBooks, “book_cover_ID”);

    Zucht, driedubbel zucht. Vieze fouten, in de zin van “Could not bind to the new value member”, en dan misleidende dingen over het internet verspreid vinden, bah.

    Die brol is verdomme case sensitive!! Nu ja, figures eigenlijk wel: die dataset (eum, DataSet eigenlijk dus 🙂 is geen database maar een XML-dinges, en XML is nu eenmaal case sensitive. Het was dus gewoon dat cover_ID moest vervangen worden door cover_id. En nu werkt het gelijk een lierken:

    Morgen doe ik de rest van die databound controls.

  • Laurence Llewellyn-Bowen’s favoriete boek is Frankenstein, de man stijgt in mijn achting.

  • Waar een beetje rust en

    Waar een beetje rust en een klaar hoofd allemaal niet goed voor zijn: die DataSet-historie met meer tabellen, ’t is eigenlijk toch niet zo ingewikkeld.

    OleDbDataAdapter da;
    DataSet dsBook=
    new DataSet(“Book”);

    da=
    new OleDbDataAdapter(“select * from tblBooks where book_id=”+ID.ToString(),cnnBooks);
    da.Fill(dsBook,”tblBooks”);
    da=
    new
    OleDbDataAdapter(“select * from tblPublishers”,cnnBooks);
    da.Fill(dsBook,”tblPublishers”);
    richTextBox2.Text=””;
    foreach (DataTable dt in
    dsBook.Tables)
    {
       richTextBox2.Text+=”table: “+dt.TableName+”\n”;
       foreach (DataColumn dc in
    dt.Columns) 
       {
          richTextBox2.Text+=”\tcolumn: “+dc.ColumnName+”\n”;
       }
    }

    En dat geeft een proper lijste van tabellen en velden:

    table: tblBooks
        column: book_ID
        column: book_title
        column: book_genre_id
        column: book_pages
        column: book_cover_ID
        column: book_year
        column: book_publisher_ID
        column: book_price
    […]
    table: tblPublishers
        column: publisher_id
        column: publisher_name

    En dan is ’t nog een kwestie van daar een relatie aan toe te voegen:

    dsBook.Relations.Add(“BookPublisher”,
        dsBook.Tables[“tblBooks”].Columns[“book_publisher_ID”],
        dsBook.Tables[“tblPublishers”].Columns[“publisher_id”],
        false);

    En dat geeft proper schoon het volgende schema:

    <?xml version=”1.0″ encoding=”utf-16″?>
    <xs:schema id=”Book” xmlns=”” xmlns:xs=”http://www.w3.org/2001/XMLSchema” xmlns:msdata=”urn:schemas-microsoft-com:xml-msdata”>
       <xs:element name=”Book” msdata:IsDataSet=”true” msdata:Locale=”nl-BE”>
          <xs:complexType>
             <xs:choice maxOccurs=”unbounded”>
                <xs:element name=”tblBooks”>
                   <xs:complexType>
                      <xs:sequence>
                         <xs:element name=”book_ID” type=”xs:int” minOccurs=”0″ />
                         <xs:element name=”book_title” type=”xs:string” minOccurs=”0″ />
                         <xs:element name=”book_genre_id” type=”xs:int” minOccurs=”0″ />
                         <xs:element name=”book_pages” type=”xs:int” minOccurs=”0″ />
                         <xs:element name=”book_cover_ID” type=”xs:int” minOccurs=”0″ />
                         <xs:element name=”book_year” type=”xs:int” minOccurs=”0″ />
                         <xs:element name=”book_publisher_ID” type=”xs:int” minOccurs=”0″ />
                         <xs:element name=”book_price” type=”xs:double” minOccurs=”0″ />
                         […]
                      </xs:sequence>
                   </xs:complexType>
                </xs:element>
                <xs:element name=”tblPublishers”>
                   <xs:complexType>
                      <xs:sequence>
                         <xs:element name=”publisher_id” type=”xs:int” minOccurs=”0″ />
                         <xs:element name=”publisher_name” type=”xs:string” minOccurs=”0″ />
                      </xs:sequence>
                   </xs:complexType>
                </xs:element>
             </xs:choice>
          </xs:complexType>
       </xs:element>
       <xs:annotation>
          <xs:appinfo>
             <msdata:Relationship name=”BookPublisher” msdata:parent=”tblBooks” 
                   msdata:child=”tblPublishers” msdata:parentkey=”book_publisher_ID”
                   msdata:childkey=”publisher_id” />
          </xs:appinfo>
       </xs:annotation>
    </xs:schema>

    Wijs! Enfin, nu zijn de kinderen terug van het zwembad. Na het eten ga ik nog eens verder kijken om die zooi in controls te krijgen en te wijzigen.

  • Leve Astor Piazzolla!

    Leve Astor Piazzolla!

  • Een oudje maar een goedje:

    Een oudje maar een goedje:

    L’histoire suivante est véridique (ceux qui veulent vérifier peuvent s’adresser aux affaires maritimes canadiennes, l’incident s’est passé en Octobre 1995). 

    Transcription d’une communication radio entre un bateau de la US Navy et les autorités canadiennes au large de Newfoundland. 

    -Américains: Veuillez vous dérouter de 15 degrés Nord pour éviter une collision. A vous. 

    -Canadiens: Veuillez plutôt vous dérouter de 15 degrés Sud pour éviter une collision. A vous. 

    -Américains: Ici le capitaine d’un navire des forces navales américaines. Je répète : Veuillez modifier votre course. A vous. 

    -Canadiens: Non, veuillez dérouter, je vous prie. A vous. 

    -Américains: ICI C’EST LE PORTE AVIONS USS LINCOLN, LE SECOND NAVIRE EN IMPORTANCE DE LA FLOTTE NAVALE DES ETATS- UNIS D’AMERIQUE. NOUS SOMMES ACCOMPAGNE PAR 3 DESTROYERS, 3 CROISEURS ET UN NOMBRE IMPORTANT DE NAVIRES D’ESCORTE. JE VOUS DEMANDE DE DEVIER DE VOTRE ROUTE DE 15 DEGRES NORD OU DES MESURES CONTRAIGNANTES VONT ETRE PRISES POUR ASSURER LA SECURITE DE NOTRE NAVIRE. A VOUS. 

    -Canadiens: Ici, c’est un phare. A vous.

    -Américains: silence.

  • Ik zie juist op CNN

    Ik zie juist op CNN dat de Amerikanen zeggen dat “substantial numbers of US troops” in “central BAghdad” zouden zijn, en dat de mensen dat zouden zien “rond de middag”.

    Het is nu 12u27 in Bagdad, en ik hoop van harte dat de Amerikanen gelijk hebben. No way dat ik hoop dat er alsnog guerillatoestanden van komen, gewoon om te bewijzen dat de VS verkeerd waren. Oorlog is vies, en hoe sneller het gedaan is , hoe beter.

  • Microsoft Infopath: I didn’t get

    Microsoft Infopath: I didn’t get it.

    Now I do.

    Miljaar, weer een goed ding van de mannen van Redmond.

    Maar nu naar bed, morgen C#, ik moet er fris op staan, die datasets met relaties en alles moeten er echt door morgen.

  • Johnny English. Nog zo’n film

    Johnny English. Nog zo’n film die ik nooit zou gaan bekijken.

  • Q&A sessie over de toekomst

    Q&A sessie over de toekomst van C#, met Anders hemzelf. Serieus interessant. Dingen als:

    Q: Will C#/etc replace VBA in Office anytime soon?

    A: C# won?t replace VBA in Office – VBA will be supported in Office for a long time. However, we will introduce a product that we are calling ?Visual Studio .NET Tools for Office.? This will let you write Office solutions using both C# and VB.NET. We are super excited about this product, and will be posting the Beta on MSDN.COM very soon.

  • Who’s the dude that

    Who’s the dude that won’t cop out when there’s lack of faith? Pope!
    He’s a consecrated man but no-one understands him but his God!

    Lenny Henry doet een kruising tussen de paus en Shaft. Fijn 🙂

  • Haha! Lenny Henry op bbc1!

    Haha! Lenny Henry op bbc1!

  • Magisch goed: de exacte woorden

    Magisch goed: de exacte woorden van Donald Rumsfeld, zoals op de website van het Amerikaanse ministerie van landsverdediging. The poetry of D.H. Rumsfeld:

    The Unknown
    As we know,
    There are known knowns.
    There are things we know we know.
    We also know
    There are known unknowns.
    That is to say
    We know there are some things
    We do not know.
    But there are also unknown unknowns,
    The ones we don’t know
    We don’t know.

    ?Feb. 12, 2002, Department of Defense news briefing

    Glass Box 
    You know, it’s the old glass box at the?
    At the gas station,
    Where you’re using those little things
    Trying to pick up the prize,
    And you can’t find it.
    It’s?

    And it’s all these arms are going down in there,
    And so you keep dropping it
    And picking it up again and moving it,
    But?

    Some of you are probably too young to remember those?
    Those glass boxes,
    But?

    But they used to have them
    At all the gas stations
    When I was a kid.

    ?Dec. 6, 2001, Department of Defense news briefing

    A Confession
    Once in a while,
    I’m standing here, doing something.
    And I think,
    “What in the world am I doing here?”
    It’s a big surprise.

    ?May 16, 2001, interview with the New York Times

    Happenings
    You’re going to be told lots of things.
    You get told things every day that don’t happen.

    It doesn’t seem to bother people, they don’t?
    It’s printed in the press.
    The world thinks all these things happen.
    They never happened.

    Everyone’s so eager to get the story
    Before in fact the story’s there
    That the world is constantly being fed
    Things that haven’t happened.

    All I can tell you is,
    It hasn’t happened.
    It’s going to happen.

    ?Feb. 28, 2003, Department of Defense briefing

    The Digital Revolution
    Oh my goodness gracious,
    What you can buy off the Internet
    In terms of overhead photography!

    A trained ape can know an awful lot
    Of what is going on in this world,
    Just by punching on his mouse
    For a relatively modest cost!

    ?June 9, 2001, following European trip

    The Situation
    Things will not be necessarily continuous.
    The fact that they are something other than perfectly continuous
    Ought not to be characterized as a pause.
    There will be some things that people will see.
    There will be some things that people won’t see.
    And life goes on.

    ?Oct. 12, 2001, Department of Defense news briefing

    Clarity
    I think what you’ll find,
    I think what you’ll find is,
    Whatever it is we do substantively,
    There will be near-perfect clarity 
                   As to what it is.

    And it will be known,
    And it will be known to the Congress,
    And it will be known to you,
    Probably before we decide it,
                   But it will be known.

    ?Feb. 28, 2003, Department of Defense briefing 

  • Tja, deze week gaat Cindy

    Tja, deze week gaat Cindy het echt niet overleven. En Chris ook pijnbank, maar wie zou de derde zijn? Tom misschien? Of Peter, want dat was niet zo goed? Of misschien Brahim, dat hij eens een schokje krijgt?

  • Natalia houdt absoluut niet van

    Natalia houdt absoluut niet van Science Fiction. He bah. En haar lievelingsfilm is Indecent Proposal. Eikes! Qua dalen in achting…

    Hoeveel wedden dat ze gaat zingen van Respect uit de Blues Brothers? Ah neen, ’t wordt Think, ook van Aretha Franklin.

    Jezus H. Christus, ze kan echt wel ongelooflijk goed zingen. Maar swingen doet het vreemd genoeg niet vind ik. Enfin, misschien is het dat ze niet graag Science Fiction heeft dat nog nazindert, maar ik geloofde het niet allemaal. Eens kijken wat de jury er van vindt.

    De jruy vond het gewoon geweldig.

  • Tom gaat een liedje van

    Tom gaat een liedje van Seal doen: Kiss from a Rose, uit Batman Forever.

    Zijn houding is niet echt je dat. En ik betwijfel of zijn stem krachtig genoeg is om het te halen. Alhoewel, nu haalt hij wel serieus uit. Tja, een beetje te smooth naar mijn goesting. Maar zeker niet slecht.