简体   繁体   中英

Visually Build Insert, Update, and Delete Functions for DataGridView Control

QUESTION:

What is the proper way to insert , update , and delete statements visually inside of Visual Studio for a Data Grid View control such as we do with the select statement?


BACKGROUND:

I've found many tutorials online showing how you can programmatically insert, update and delete records via the data found in the data grid when it's in edit mode however none that show the built in, "visual" functions such as we have with the select query.

Now when connecting to the database, Visual Studio generates a DataSet in which we can actually go in under SqlTableAdapter and find our select query that was generated for us but when we add an insert query (which is possible!) into that interface it shows up along side our select query such as here:

SqlTableAdapterQuery

However when going back to the data grid view and selecting "Add Query" the new insert query doesn't show up:

向数据网格视图添加新查询 选择现有查询数据网格视图

I've found the solution.

To visually add Insert, Update, and Delete statements to a data grid follow the steps above and in "TableAdapter Configuration Wizzard" select advanced options as shown below.


高级选项-表适配器配置向导

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM