create table

  • Thread starter Thread starter Roy Gourgi
  • Start date Start date
R

Roy Gourgi

Hi,

How would I create a table programmatically 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
 
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.
 
Back
Top