| 发表于:2008-02-27 08:08:48 楼主 |
以下是程序 option explicit public adocnn as new adodb.connection public rs, rs2 as new adodb.recordset public sub connection() if adocnn.state = adstateopen then adocnn.close end if adocnn.provider = "microsoft.jet.oledb.4.0" adocnn.open app.path & "\瓶盖.mdb" end sub private sub cmdcancel_click() frmmain.show unload me end sub private sub cmdok_click() dim strsql as string dim temp as integer if chksale.value = 1 then strsql = "select * from 出售" call connection rs.cursorlocation = aduseclient rs.open strsql, adocnn, adopendynamic, adlockoptimistic rs.addnew rs.fields(1) = textmarket.text rs.fields(2) = textnombreg.text rs.fields(3) = textnombrep.text rs.addnew end if if chkrecede = 1 then strsql = "select * from 回收" call connection rs.cursorlocation = aduseclient rs.open strsql, adocnn, adopendynamic, adlockoptimistic rs.addnew rs.fields(1) = textmarket.text rs.fields(2) = textnombreg.text rs.fields(3) = textnombrep.text rs.addnew end if temp = msgbox("是否继续输入?", vbyesno) if temp = 6 then textmarket.text = "" textcode.text = "" textnombreg.text = "" textnombrep.text = "" else frmmain.show unload me end if end sub private sub datagrid1_click() textmarket.text = rs2.fields(0) end sub private sub textcode_keypress(keyascii as integer) if keyascii = 13 then dim strsql3, temp as string temp = textcode.text strsql3 = "select * from 商店 where 商店代码 = '" + cstr(temp) + "'" call connection rs2.cursorlocation = aduseclient rs2.open strsql3, adocnn, adopendynamic, adlockoptimistic set datagrid1.datasource = rs2 end if end sub private sub textnombreg_keypress(keyascii as integer) if keyascii = 13 then call cmdok_click end if end sub private sub textnombrep_keypress(keyascii as integer) if keyascii = 13 then call cmdok_click end if end sub |
|
|
|
|