471,306 Members | 1,226 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

create table

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


Jan 4 '06 #1
1 1456
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]
- mv*@spam.guard.caspershouse.com

"Roy Gourgi" <ro***@videotron.ca> wrote in message
news:6O*********************@weber.videotron.net.. .
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

Jan 4 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Michael Jackson | last post: by
7 posts views Thread by Wolfgang Kreuzer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.