请教一个VB的问题,多谢了

来源:百度知道 编辑:UC知道 时间:2024/06/22 07:22:45
这句话:
Adodc1.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;_
data source="&text2.text&";persist security info=false"
我是照书里打出来的,但是写上去却说缺少语句,在text&“那地方,是什么原因啊?我打中间那个text2.text都没有提示。

还有这句也是:
adodc1.RecordSource ="select"& combo1(0).Text &".年份,"&LX& _
"from"&combo1(0).Text &"where" & i1
提示“from”这地方缺少语句。

Adodc1.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=" & text2.text & ";persist security info=false"

adodc1.RecordSource ="select" & combo1(0).Text & ".年份," & LX & _
"from" & combo1(0).Text & "where" & i1

注意空格

&号前后都加上空格

Adodc1.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;
data source=" & text2.text & ";persist security info=false"
adodc1.RecordSource ="select " & combo1(0).Text & ".年份," & LX & " from " & combo1(0).Text & " where " & i1

前一句没看出来,下边你的","是大写的,语句间没有空格,应该是这样:
adodc1.RecordSource ="select "& combo1(0).Text &".年份," & LX & " from "&combo1(0).Text &" where " & i1

“&”前后的空格空开就没事了。

source="&text2.text&";persist
改成 source=" & text2.text & ";persist
注意 & 符号的前