Click here to Skip to main content
14,836,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We just want to generate SQL server database base script having schema & data programmatically using c#.
The SQL server database is in Hosting Server.
Posted
Comments
V Senthil Kumar 10-Jul-15 3:56am
   
click Generate Scripts and Choose Advanced Setting And Choose TYPE OF DATA TO SCRIPT And SELECT Schemes And DATA ...

click Generate Scripts and Choose Advanced Setting And Choose TYPE OF DATA TO SCRIPT And SELECT Schemes And DATA ...
   
Comments
Chandra Kant Dubey 10-Jul-15 3:59am
   
@senthil@Madurai
Not from Wizard I am asking about generating script programmatically using c# no interaction from sql server only from c#.
If you just have the possibility, using SMO (Sql Management Objects)[^] is probably the easiest way. Especially using Scripter class[^].

For example have a look at http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated[^]
   
Comments
Chandra Kant Dubey 10-Jul-15 7:20am
   
Sir ! We would like to create script with data and save it on client site. my SQL server is hosted on different server so please suggest me how to generate and how to save generate script at client site.
Wendelius 10-Jul-15 7:41am
   
It doesn't matter that the server is located on another computer. SMO is a library that can be used in your C# application. using this library you can connect to a remote server.

The only requirement is that SMO is installed on the client or distributed with the application. Have a look at https://msdn.microsoft.com/en-us/library/ff713979(v=sql.105).aspx[^]

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