问题描述
我正在尝试在子窗体的load事件中创建TableAdapter查询,该查询将显示用户从父级选择的选定行的数据(当双击DGV的行标题时)形式.除了子窗体的TableAdapter查询应该从父窗体的DGV加载单独选择的行的数据(子窗体用于编辑父DGV的数据)之外,我一切正常.
父窗体使用DataGridView.SelectedRows(i).Index
识别用户选择的所选行.如何将其集成到查询中以告诉SQL我希望它填充我的表,其中列名Task_ID =用户选择的所选行的值.
子表单当前正在使用默认填充功能
I''m trying to create a TableAdapter query in my child form''s load event that will show the data of a selected row the user chooses(when the DGV''s row header is double clicked)from the parent form. I have everything working fine except the child form''s TableAdapter query that should load data of an individually selected row from the parent form''s DGV (child form is used for editing data from the parent''s DGV).
The parent form uses DataGridView.SelectedRows(i).Index
to recognize the selected row the user chooses. How can I integrate this into a query to tell SQL I want it to fill my table where column name Task_ID = the value of the selected row choosen by the user.
The child form is currently using the default fill function
Me.TasksTableAdapter.Fill(Me.TodolistDataSet.tasks)
当前的SQL语句是
The current SQL statement is
SELECT Task_ID, Project_ID, Description_, Priority_Level, Sub_Level, Requested_Date, Comments, Fixed_Date, Software_Version, Requested_By FROM dbo.tasks
我正在使用VS2010专业版,.NET Framework 4客户端配置文件,MySQL2010
在此先感谢您的帮助.
[edit] Sql从内联代码转换为代码块,标记-OriginalGriff [/edit]
I''m using VS2010 professional,.NET Framework 4 Client Profile,MySQL2010
Thanks in advance for any help.
[edit]Sql converted from inline code to code block, Tags - OriginalGriff[/edit]
推荐答案
SELECT Task_ID, Project_ID, Description_, Priority_Level, Sub_Level, Requested_Date, Comments, Fixed_Date, Software_Version, Requested_By FROM dbo.tasks WHERE Task_ID = Global_TaskID
然后使用此
Then use this
Me.TasksTableAdapter.Fill(Me.TodolistDataSet.tasks)
这篇关于VS2010 TableAdapter查询,DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!