直接从数据库中选择数据 [英] data from database directly without selecting
问题描述
大家好,
在我的项目中,有一个页面向员工分配任务,因为我需要帮助.
当在下拉列表中将任务辅助给员工时,我们选择employeename,taskname,taskactivity和另一列taskId.现在我的疑问是选择了这三个下拉列表之后,选择的taskname应该是哪个taskid应该自动从数据库进入该列.
我需要怎么做,请帮助我.
hi all,
In my project there is a page of assigning tasks to the employees in that i need help.
when assiging the task to a employee in the dropdown list we select the employeename,taskname,taskactivity and another column taskId.now my doubt is after selecting these three dropdowns then what taskname there are selecting that taskid should automatically come from database in to that column.
how i need to do please help me.
thanks.
推荐答案
在下拉列表的OnSelectedIndexChanged
事件上编写必要的代码以选择taskid.
Write the necessary code to select the taskid on the OnSelectedIndexChanged
event of dropdownlist.
您可以存储TakName和TaskID都在一个下拉列表中
看到此代码
You can store both the TakName and TaskID in a single dropdownlist
See this code
Dim dt as datatable
ddlTask.DataSource=dt
ddlTask.DataTextField="taskname"
ddlTask.DataValueField="taskid"
ddlTask.DataBind()
现在,当您要选择TaskName时,请
Now when you want to select TaskName then
ddlTask.SelectedItem.Text
如果要获取任务ID,则
and if you want to get task iD then
ddlTask.SelectedValue
这篇关于直接从数据库中选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!