怎么在小弟我点击combo选项时,数据库的相应数据被调出,并在textbox中显示
如何在我点击combo选项时,数据库的相应数据被调出,并在textbox中显示
Private Sub Combo1_click()
Text2.Text = Combo1.Text
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=custinfo9797.mdb;Persist Security Info=False "
con.CursorLocation = adUseClient
con.Open
mysql = "select Market/Brand,ContactPerson from CustomerInfo where CustomerInfo!CompanyName= 'text1(0).Text ' "
Set rs = con.Execute(mysql)
Text1(2).Text = rs.Fields( "Market/Brand ")
Text1(3).Text = rs.Fields( "ContactPerson ")
End Sub
我在调试时出现三个问题:
1.text1(0)不能获得combo的text
2.至少一个参数未定义
3.text1(2), ext1(3)不能获得相应数据
即当companyname公司名为:中路公司时,市场market和contactperson不显示,
------解决方案--------------------
mysql = "select Market/Brand,ContactPerson from CustomerInfo where CustomerInfo!CompanyName= ' " & text1(0).Text & " ' "
————————————————————————————————————
现在的人们要求越来越高!事情还是十画还没有一撇,就要源码!
------解决方案--------------------
Private Sub Combo1_click()
Text1(0).Text = Combo1.Text
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=custinfo9797.mdb;Persist Security Info=False "
con.CursorLocation = adUseClient
con.Open
mysql = "select Market/Brand,ContactPerson from CustomerInfo where CustomerInfo!CompanyName= 'text1(0).Text ' "
Set rs = con.Execute(mysql)
Text1(2).Text = rs.Fields( "Market/Brand ")
Text1(3).Text = rs.Fields( "ContactPerson ")
End Sub
Private Sub Combo1_click()
Text2.Text = Combo1.Text
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=custinfo9797.mdb;Persist Security Info=False "
con.CursorLocation = adUseClient
con.Open
mysql = "select Market/Brand,ContactPerson from CustomerInfo where CustomerInfo!CompanyName= 'text1(0).Text ' "
Set rs = con.Execute(mysql)
Text1(2).Text = rs.Fields( "Market/Brand ")
Text1(3).Text = rs.Fields( "ContactPerson ")
End Sub
我在调试时出现三个问题:
1.text1(0)不能获得combo的text
2.至少一个参数未定义
3.text1(2), ext1(3)不能获得相应数据
即当companyname公司名为:中路公司时,市场market和contactperson不显示,
------解决方案--------------------
mysql = "select Market/Brand,ContactPerson from CustomerInfo where CustomerInfo!CompanyName= ' " & text1(0).Text & " ' "
————————————————————————————————————
现在的人们要求越来越高!事情还是十画还没有一撇,就要源码!
------解决方案--------------------
Private Sub Combo1_click()
Text1(0).Text = Combo1.Text
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=custinfo9797.mdb;Persist Security Info=False "
con.CursorLocation = adUseClient
con.Open
mysql = "select Market/Brand,ContactPerson from CustomerInfo where CustomerInfo!CompanyName= 'text1(0).Text ' "
Set rs = con.Execute(mysql)
Text1(2).Text = rs.Fields( "Market/Brand ")
Text1(3).Text = rs.Fields( "ContactPerson ")
End Sub