Dataset problem with column named "System"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Botha

    #1

    Dataset problem with column named "System"

    The customer has a database with a column in a table named "System". I've
    been using this method for years now - create a dataset (an .xsd file) for
    the table. With a column named "System" in the dataset, it gives a
    substantial number of compile errors.

    To simplify the problem, add a Dataset with one table and one column called
    "System" - below follows how it can be done:
    Right click on the solution, click "Add", click "New Item" and then
    "DataSet" and DataSet1 is OK for the name.
    On the design sheet of DataSet1.xsd, right click. click "Add" and click
    "DataTable" .
    Right click on the DataTable and click "Add" and click "Column".
    Rename the column from "Column1" to "System".
    Build the project = compile errors.
    Note that renaming the column to "[System]" rather than "System" does not
    work either.


  • Marc Gravell

    #2
    Re: Dataset problem with column named "System&qu ot;

    You are best-off avoiding things called "System"; unfortunately, it
    means that anything with explicit namespace resolution (i.e. what the
    designer spits out) will break, unless you start using aliases, or the
    global prefix. Seriously - just cheat and call it SystemFlag or
    similar; it just isn't worth the pain...

    Marc

    Comment

    • Chris Botha

      #3
      Re: Dataset problem with column named "System&qu ot;

      Hi Mark, thanks. Alias or global prefix sounds good - as this is just one
      column, if you know how please let me know?


      "Marc Gravell" <marc.gravell@g mail.comwrote in message
      news:1190060114 .708120.308550@ 57g2000hsv.goog legroups.com...
      You are best-off avoiding things called "System"; unfortunately, it
      means that anything with explicit namespace resolution (i.e. what the
      designer spits out) will break, unless you start using aliases, or the
      global prefix. Seriously - just cheat and call it SystemFlag or
      similar; it just isn't worth the pain...
      >
      Marc
      >

      Comment

      • Cor Ligthert[MVP]

        #4
        Re: Dataset problem with column named &quot;System&qu ot;

        Chris,

        In my opinion is Marc his advice very good, spare you the time, with this
        word you have the change that it will happen again later.

        Cor

        "Chris Botha" <chris_s_bothaA T@hotmail.comsc hreef in bericht
        news:O8r$5vW%23 HHA.4612@TK2MSF TNGP03.phx.gbl. ..
        Hi Mark, thanks. Alias or global prefix sounds good - as this is just one
        column, if you know how please let me know?
        >
        >
        "Marc Gravell" <marc.gravell@g mail.comwrote in message
        news:1190060114 .708120.308550@ 57g2000hsv.goog legroups.com...
        >You are best-off avoiding things called "System"; unfortunately, it
        >means that anything with explicit namespace resolution (i.e. what the
        >designer spits out) will break, unless you start using aliases, or the
        >global prefix. Seriously - just cheat and call it SystemFlag or
        >similar; it just isn't worth the pain...
        >>
        >Marc
        >>
        >
        >

        Comment

        • Marc Gravell

          #5
          Re: Dataset problem with column named &quot;System&qu ot;

          Demo below, but this is *not* a good idea; it will keep biting you,
          and could make IDE functions like the forms designer very unreliable.

          using SomeAlias = System;

          class SystemDemo
          {
          bool System { get { return true; } }
          void AliasDemo()
          {
          SomeAlias.Net.T ransportType type =
          SomeAlias.Net.T ransportType.Tc p;
          }
          void GlobalDemo()
          {
          global::System. Net.TransportTy pe type =
          global::System. Net.TransportTy pe.Tcp;
          }
          }

          Comment

          Working...