Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create database and table pro grammatically in SQL server using vb.net
Posted

SQL Server Management Objects[^] provides mechanisms required to do this.

Regards
Espen Harlinn
 
Share this answer
 
Comments
JF2015 29-Jan-11 12:01pm    
Good!!
Espen Harlinn 29-Jan-11 12:43pm    
Thanks JF2015!
Al you have to do is issue the SQL commands: There is a question & answer here[^] that covers it pretty well. It's in C#, but it's trivial code to convert to VB.
 
Share this answer
 
Comments
Espen Harlinn 29-Jan-11 5:11am    
5+ it's obviously an option
1. you can store the table creation script as a string and pass the string as text to an SQL Command object. This command object can then be used with the ExecuteNonquery method to invoke the command and create the table.

2. A parametrized stored procedure may be used to return the create table script which may then be programatically executed on the database.



Regards,
Syed Ahsan Subhan
 
Share this answer
 
This[^] article may help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900