将2表绑定到GridView并更新删除功能 [英] Bind 2 table into GridView and update delete function

查看:52
本文介绍了将2表绑定到GridView并更新删除功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个表:

•表1:SubID,SubName,SubDescription,SubStatus

•表2:ProID,ProName,SubID,ProContent,ProDate,ProStatus

我想在表格中显示带有SubName的表2并更新ProContent和Prostatus。 ProStatus的值为True和False。

如何显示表并执行更新和删除查询?

I have 2 tables:
• Table 1: SubID, SubName, SubDescription, SubStatus
• Table 2: ProID, ProName, SubID, ProContent, ProDate, ProStatus
I would like to display the Table 2 with the SubName in the table and update the ProContent and Prostatus. The ProStatus has a value of True and False.
How can I display the table and perform the update and delete queries?

推荐答案

选择a.SubID,a.SubName,a。 SubDescription,a.SubStatus,b.ProID,b.ProName,b.SubID,b.ProContent,b.ProDate,b.ProStatus from table1 as a inner join table2 as b on a.SubID = b.SubId ..





在你的GridView中显示以上结果...



编辑,删除意味着SUBID
select a.SubID, a.SubName, a.SubDescription,a.SubStatus,b.ProID,b.ProName, b.SubID, b.ProContent, b.ProDate, b.ProStatus from table1 as a inner join table2 as b on a.SubID=b.SubId..


Show above result inyour GridView...

Edit,Delete By Means SUBID


好吧,让我们一步一步走:



1.写一个 SQL JOIN [ ^ ]查询以从多个表中获取所需数据。

2.使用SQLCommand,DataAdapter,DataSet / DataTable从DB获取记录。请参阅: https://www.youtube.com/watch?v=1EpYqtSlOr8 [ ^ ]

3.将DataTable / DataSet绑定到你的Gridview。您可以在此处找到有关此内容的更多信息: http://www.aspdotnet-suresh.com/search/label/Gridview [ ^ ]

4.然后,您可以在GridView上执行CRUD操作。 http:// www.aspsnippets.com/Articles/GridView-CRUD-Select-Insert-Edit-Update-Delete-using-Single-Stored-Procedure-in-ASPNet.aspx [ ^ ]



-KR
Well, Let's go step by step:

1. Write a SQL JOIN[^] Query to get the desired data from more than one tables.
2. Use SQLCommand, DataAdapter, DataSet/DataTable to get the records from DB. Refer this: https://www.youtube.com/watch?v=1EpYqtSlOr8[^]
3. Bind the DataTable/DataSet to your Gridview. You can find more information about that here: http://www.aspdotnet-suresh.com/search/label/Gridview[^]
4. Then, you can perform your CRUD operation on GridView. http://www.aspsnippets.com/Articles/GridView-CRUD-Select-Insert-Edit-Update-Delete-using-Single-Stored-Procedure-in-ASPNet.aspx[^]

-KR


这篇关于将2表绑定到GridView并更新删除功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆