相同的数据必须保存在两个不同的表中 [英] Same data has to be saved in two different table

查看:62
本文介绍了相同的数据必须保存在两个不同的表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

frens我有两个包含相似字段的表,我有两个表格形式的列表框.我第一次将所有数据保存在一个表中,一旦我保存一个项目的值,就会在listbox1中显示该项目,例如"itemname".现在,我将项目名称从一个列表框移动到另一个列表框,而listbox1将不包含该项目名称.现在我想做的是,我想保存带有我移到第二个表中的listbox2的值的项目,其中包含所有先前输入的值.有人请看您是否可以在编码方面帮助我.


谢谢

frens i have two tables consisting of similar fields , i have two list boxes in the form. for the first time i will save all the data in one table, as soon as i save one value of item will be displayed in the listbox1 for example "itemname". now i will move the item name from one list box to another,and the listbox1 will not contain that item name. now wat i want to do is, i want to save the item with the values which i moved to listbox2 in the second table with all the previosouly entered values. someone pls see that if u can help me with codeing part.


Thank you

推荐答案

K.只需在sql中编写代码以从table1检索itemname的信息(将其从listbox1移至listbox2),然后按以下方式将其插入table2

K. Just write a code in sql to retrieve information of itemname (which you moved form listbox1 to listbox2) from table1 and insert it to table2 in the following manner

Insert into table2[column_names]
Select [column_names] from table1 where [column_name] = @parameter
/* 
Here column_names means what the columns you want to insert.
@paramenter means itemname you want to pass form listbox.  user stored procedure to increase performance and avoid security leaks in the application.
column_name means what is the column you are looking for.
*/


在使用任何可能的解决方案之前,请先帮自己一个忙,请阅读并理解以下内容:
Before you get to any of the possible solutions do yourself a favor, read and understand this: http://en.wikipedia.org/wiki/Don%27t_repeat_yourself[^].

—SA


这篇关于相同的数据必须保存在两个不同的表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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