472,118 Members | 1,054 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

How to execute DROP/CREATE TABLE from c#?

using System;
using System.Data;
using System.Data.SqlClient;

class App
static void Main(string[] args)
string SQL = @"Create table Foo
Bar int
SqlConnection conn = new SqlConnection("server=.;integrated security=SSPI; database=pubs");


SqlCommand cmd = new SqlCommand(SQL, conn);

Obviously you need the permissions in the database to be able to perform the operations


Richard Blewett - DevelopMentor


nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<A3**********************************@microsoft.co m>

How can I execute a DROP/CREATE TABLE statement from code using c#?

Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004

Nov 16 '05 #1
0 7173

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by James Knowlton | last post: by
3 posts views Thread by David Link | last post: by
5 posts views Thread by Andrew | last post: by
reply views Thread by Andres Romero | last post: by
2 posts views Thread by Brian Tkatch | last post: by
6 posts views Thread by Oliver | 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.