[轉載]Generate SQL INSERT commands Programmatically
Posted on 2007-09-27 12:05 Kejames 阅读(157) 评论(0) 收藏 举报Introduction
When you use TableAdapters in C#, VS generates INSERT, SELECT and UPDATE etc commands for you.
Other commands can be added by going into DataSet Designer and adding commands via the Add SQL Wizard.
Sometimes, however, you need additional SQL commands that contain a complete list of all the fields in the DataSet. You would also like these lists to be automatically updated whenever a change is made to the Database.
The code presented here does this by using functions in the Designer code to generate such strings.
Download demo project and source - 31 Kb
---
http://www.codeproject.com/useritems/GenerateSQL.asp
浙公网安备 33010602011771号