| 发表于:2007-02-06 15:53:487楼 得分:0 |
我是先执行下面的代码`` private sub txtcolorid_selectedindexchanged(byval sender as system.object, byval e as system.eventargs) handles combcolorid.selectedindexchanged if me.txtshoesid.text.trim.length = 0 and me.txtshoesid.text.trim.length then msgbox( "请输入正确的数据! ", msgboxstyle.information, "提示 ") me.txtshoesid.focus() me.combnoid.focus() exit sub end if sqlcmd.commandtext = "select 名称 ,尺寸 ,颜色,价格,数量 from 库存表 where 名称=@shoesid and 尺寸=@noid and 颜色=@colorid " sqlcmd.parameters.add( "@shoesid ", sqldbtype.varchar) sqlcmd.parameters( "@shoesid ").value = me.txtshoesid.text sqlcmd.parameters.add( "@noid ", sqldbtype.int) sqlcmd.parameters( "@noid ").value = me.combnoid.text sqlcmd.parameters.add( "@colorid ", sqldbtype.varchar) sqlcmd.parameters( "@colorid ").value = me.combcolorid.selecteditem sqlcmd.connection = module1.sqlconn sqlda.selectcommand = sqlcmd dim sqldr as sqldatareader try if module1.sqlconn.state <> connectionstate.open then module1.sqlconn.open() end if sqldr = sqlcmd.EXECutereader(commandbehavior.closeconnection) if sqldr.read then me.txtunitprice.text = sqldr( "价格 ") me.txtstockquantity.text = sqldr( "数量 ") end if catch ex as exception msgbox( "发生错误: " & ex.message) module1.sqlconn.close() end try module1.sqlconn.close() end sub 执行完后我接着执行二个代码`` module1.sqlconn.open() try dim str as string sqlcmd.connection = module1.sqlconn str = "insert into 销售表(名称,尺寸,颜色,价格) values ( ' " & txtshoesid.text.trim() & " ', ' " & combnoid.selecteditem.tostring() & " ', ' " & combcolorid.selecteditem.tostring() & " ', ' " & txtunitprice.text.trim() & " ') " sqlcmd.commandtype = commandtype.text sqlcmd.EXECutenonquery() messagebox.show( "成功! ", "提醒 ", messageboxbuttons.ok, messageboxicon.information) catch ex as exception messagebox.show(ex.message) module1.sqlconn.close() end try 这个现在也可以了``` 但是主要的是我插入的数据没有加载到我的销售表里面`` 小弟想请大哥们帮个忙`` 到底是那边出先问题了```应该在那边改,也顺便想大哥把我的代码复制下,然后修改下回复给小弟``小弟在这边先谢谢了~!~ | | |
|