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");
conn.Open();
SqlCommand cmd = new SqlCommand(SQL, conn);
cmd.ExecuteNonQuery();
}
}
Obviously you need the permissions in the database to be able to perform the operations
Regards
Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
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
[microsoft.public.dotnet.languages.csharp]