VB.NET App:如何遍历列表框项以执行SQL插入? [英] VB.NET App: How to loop through listbox items to perform a SQL insert?
问题描述
Hiya,我需要根据以前创建的作品,根据制作的标题和列表框中每个选定的演讲者,将演讲者ID和制作ID添加到关联表中。
以下代码函数,但只选择第一次出现,然后向表中添加多个重复条目(基于选择了多少项)。
Hiya, I am needing to add a Speaker ID and Production ID to an associative table based on a production that was previously created, based on the title of the production and every selected Speaker in a listbox.
The following code functions, but only selects the first occurance and then adds multiple duplicate entries to the table (based on how many items were selected).
推荐答案
Hiya,我需要添加基于生产标题和列表框中每个选定的扬声器,基于先前创建的制作的关联表的演讲者ID和制作ID。
以下代码功能,但只选择第一次出现,然后在表格中添加多个重复的条目(根据选择的项目数量)。
Hiya, I am needing to add a Speaker ID and Production ID to an associative table based on a production that was previously created, based on the title of the production and every selected Speaker in a listbox.
The following code functions, but only selects the first occurance and then adds multiple duplicate entries to the table (based on how many items were selected).
嗯,我得到一个类型'listitem''没有定义例外。
Hmm, I''m getting a "type ''listitem'' is not defined" exception.
嗯,我得到的是类型'listitem''未定义例外。
Hmm, I''m getting a "type ''listitem'' is not defined" exception.
这很奇怪......
ListItem应该包含在应用程序的默认库中。
您能否发布您的包含/导入声明?
That is rather strange...
ListItem should be included in the default libraries for applications.
Could you please post your include/import statements?
这篇关于VB.NET App:如何遍历列表框项以执行SQL插入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!