kejames 學習筆記本

這裡是Kejames的筆記本,歡迎各位網友給予指教,謝謝。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

[轉載]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