做WPF项目中,下拉框绑定数据是必不可少的一个功能,这个功能是把存在数据库对应的相关数据取出来,就比如一个颜色的下拉框选项,当你点击这个下拉框的时候就会把你储存在数据库的数据全部查询出来
1、这个是数据库的存储过程,@Type后面接的是方法名是执行数据查询的根据,根据自己建表的思路把所需要的列查询出来,我下面是从t_detailed_attribute_gather表里根据t_detailed_attribute_gather.attribute_gather_id =7的条件来查询detailed_attribute_gather_id、detailed_attribute_gather_name重命名为Color_id、Color_name,在不触发执行查询的时候,后面拼接了个请选择选方便区分。
IF(@Type='InsertCommodity_Loaded_SelectColor')
SELECT RTRIM(detailed_attribute_gather_id