NETTable creation through ADO.NET?
-
Hi, My question for all you ADO.NET gurus is: Is there a database-agnostic way to create a set of new tables through ADO.NET. This is the sort of thing that I would have used ADOX for prior to .NET, but there seems no equivalent. I am working on a product that will use any database, creating the required tables on the fly if they don't exist (usually as initialisation the first time the software is run). Anybody got any bright ideas, or am I going to have to generate the correct 'CREATE TABLE' syntax for each possible database type? Dr Herbie. Remember, half the people out there have below average IQs.
-
Hi, My question for all you ADO.NET gurus is: Is there a database-agnostic way to create a set of new tables through ADO.NET. This is the sort of thing that I would have used ADOX for prior to .NET, but there seems no equivalent. I am working on a product that will use any database, creating the required tables on the fly if they don't exist (usually as initialisation the first time the software is run). Anybody got any bright ideas, or am I going to have to generate the correct 'CREATE TABLE' syntax for each possible database type? Dr Herbie. Remember, half the people out there have below average IQs.
what's wrong if you use this "correct 'Create Table'" syntax. i create entire databases this way. SQL-Server creates the script, and we pack this in a text file which can be read using text reader and executed using an sql Command. Can it be any simpler?
-
what's wrong if you use this "correct 'Create Table'" syntax. i create entire databases this way. SQL-Server creates the script, and we pack this in a text file which can be read using text reader and executed using an sql Command. Can it be any simpler?
Using scripts from SQLServer is all very well, but we have to support ALL databases; SQLServer, Oracle, FoxPro, DBase, MySQL, MS Access, etc., (including any databases not yet written) CREATE TABLE syntax is similar between different DB vendors, but not identicle. Therefore we need a vendor-agnostic method. ADOX supplied this, as the driver created the actual SQL statement to create the table from a structure you created in code. I was hoping ADO.NET would have something similar, but it doesn't look promising.:( One option would be to get SQL Server to dump out table structures as XML, then use different XSLT files to transform the XML into database specific script files, but I was hoping to avoid any of that. Ho-hum, better dig that 'Learn XSLT in one easy lesson' book out.:sigh: Dr Herbie. Remember, half the people out there have below average IQs.