create table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roy Gourgi

    #1

    create table

    Hi,

    How would I create a table programmaticall y in a database. I am using C#
    2005 Express edition.

    For example I want to create a table named tblHours in a database
    dbEmployees with the columns hours worked (integer), hourly pay (currency),
    etc....


    TIA
    Roy




  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: create table

    Roy,

    You can create a statement to do this, like so:

    create table tblHours ([hours worked] int, [hourly pay] currency)

    I think you have to use a decimal type (with precision and scale), as I
    dont think there is a currency type.

    But that's about it really. Then, you take this statement, and assign
    it to a SqlCommand, and execute it.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Roy Gourgi" <royng@videotro n.ca> wrote in message
    news:6OEuf.5701 8$DQ4.1510886@w eber.videotron. net...[color=blue]
    > Hi,
    >
    > How would I create a table programmaticall y in a database. I am using C#
    > 2005 Express edition.
    >
    > For example I want to create a table named tblHours in a database
    > dbEmployees with the columns hours worked (integer), hourly pay
    > (currency),
    > etc....
    >
    >
    > TIA
    > Roy
    >
    >
    >
    >[/color]


    Comment

    Working...