基于Dropdownlist.SelectedItem & 发送电子邮件还将 Dropdownlist.SelectedValue 插入数据库
我不知道该怎么办。我有一个带有下拉列表的网络表单,名为“招聘人员”。我有两个名为 Perm_Commission_Lookup 和 Perm_Commission_Lookup 的 SQL 表。用户列表。
其中一个表包含电子邮件,而另一个则不包含。 Perm_Commission_Lookup 表不包含招聘人员的电子邮件,因此我决定将其与包含招聘人员电子邮件的 UserList 表进行内部联接。 Perm_Commission_Lookup 表中的 LookupValue(招聘人员的显示名称)列是向最终用户显示的内容,pk_LookupID 列是插入到数据库中的列。
我想要实现的是:当用户从招聘人员下拉列表中选择“John Doe”时,我想向 John Doe 发送一封电子邮件,提醒他表单已提交,同时插入所选内容值 (pk_LookupID) 存入数据库。
我看到下拉列表有两个名为: DataTextField="LookupValue" 和 DataValueField="pk_LookupID 的字段,但如何获取 User_Email 是我的主要问题。下面是我的 SQL选择...到目前为止,我可以执行 SQL INNER JOIN...如下所示,我还可以在下拉列表中显示多列...我也在尝试 SQLDataReader 但我只是停止如何完成它任何
SELECT Perm_Commision_Lookup.pk_LookupID, Perm_Commision_Lookup.LookupValue, UserList.User_Email
FROM Perm_Commision_Lookup
INNER JOIN UserList ON Perm_Commision_Lookup.LookupUserName = UserList.GM_Username
帮助将不胜感激...
I don't know how to go about this. I have a web form with dropdown list, named Recruiter. I have two SQL tables named Perm_Commision_Lookup & UserList.
One of the tables contain email and the other does not. The Perm_Commision_Lookup table does not contain recruiter's email, so I decided to Inner Join it with UserList table which contain recruiter emails. The LookupValue (Recruiter's display name) column from the Perm_Commision_Lookup table is what's displayed to the end user and the pk_LookupID column is the one that's inserted into the database.
What I want to achieve is this: When a user select let's say "John Doe" from the Recruiter dropdown list, I want to send out an email to John Doe alerting him that a form has been submitted and at the same time insert the selected value (pk_LookupID) into the database.
I see that the dropdown list has two field named: DataTextField="LookupValue" and DataValueField="pk_LookupID but how to get the User_Email is my major problem. Below is my SQL select...So far I can do a SQL INNER JOIN...which shown below and also I can display multiple columns into dropdown list...I'm also trying SQLDataReader but I'm just stop with how to get it done.
SELECT Perm_Commision_Lookup.pk_LookupID, Perm_Commision_Lookup.LookupValue, UserList.User_Email
FROM Perm_Commision_Lookup
INNER JOIN UserList ON Perm_Commision_Lookup.LookupUserName = UserList.GM_Username
Any help will be appreciated...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢您的回复!正确的!它通过 LookupUserName 链接。这就是我现在所拥有的......但仍然有问题
Public Sub BindDropDownListData()
' 连接字符串
Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
Thanks for your reply! Correct! It's linked via LookupUserName. That's what I have as for now...but still have the problem
Public Sub BindDropDownListData()
' connection string
Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
1:使用下拉selectedIndexChanged事件。
2:在处理程序内部查询数据库以获取电子邮件并发送电子邮件。
3:您可以从 SelectedIndexChanged 处理程序的下拉列表中选择查找名称(如 myddl.SelectedItem.Text),也可以获取查找 ID(如 myddl.SelectedValue)。
从您的查询来看,您的表似乎是通过 LookupUserName 正确链接的,还是 LookupId 链接的?
这可能会有所帮助。
1: Use dropdown selectedIndexChanged event.
2: Inside the handler query the database to get the Email and send email.
3: You can selected lookupname from dropdown in the SelectedIndexChanged handler like myddl.SelectedItem.Text or you can get lookupid like myddl.SelectedValue.
From your query it seems your tables are linked via LookupUserName correct or is it LookupId?
And this might help.