Is there an ASP.NET SQL library for manipulating tables?
Does anyone know of a library SQL
in ASP.NET
that can be used to manipulate tables?
eg.
SQLTable table = new SQLTable();
table.AddColumn("First name", varchar, 100);
table.AddColumn("Last name", varchar, 100);
if(table.ColumnExists("Company"))
table.RemoveColumn("Company");
The operations I'm looking for are adding, editing and deleting tables, fields, indexes and foreign keys.
It can be done with SQL
, but it's messy, I'm looking for a clean API that is intuitive.
Use Microsoft.SqlServer.Management.Smo
Another option would be to install Microsoft Sql Server Web Data Administrator
Sql Server Web Data Administrator
Some links for Smo:
Create table in SQL Server 2005 using C # and SMO
How to create, modify and drop a table in Visual Basic .NET (sorry for choosing a language)
Subsonic has a migrations function. It's pretty new, but I think it fits your "intuitive" requirement.
I would tell you to use SQL DMO, but it looks like this is discontinued in appearance:
http://msdn.microsoft.com/en-us/library/ms131540.aspx
Not sure if it's replaced.