<>Dim a As ADODB.Connection<br>Dim b As ADODB.Recordset </P>
<>Dim c,d As String<br>Set a = New ADODB.Connection<br>Set b = New ADODB.Recordset</P>
<>d=combo0.text</P>
<P>a.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\合作医疗.mdb;User ID=;Password=;")</P>
<P>c = "Select [区域],[村] from [destrict1] where [区域]='" & d & "';"</P>
<P>b.Open c, a, adOpenKeyset, adLockOptimistic</P>
<P>其中这句SQL c = "Select [区域],[村] from [destrict1] where [区域]='" & d& "';"是从网上抄下来的,里面的引号为什么要这么写才正确。但是</P>
<P>写成c = "Select [区域],[村] from [destrict1] where [区域]= & d & ;"</P>
<P>或者c = "Select [区域],[村] from [destrict1] where [区域]=" &d & ";"</P>
<P>或者c = "Select [区域],[村] from [destrict1] where [区域]=' & d & ';"</P>
<P>都不对,不是缺少括号语法错误,就是“至少一个参数未被指定”,这里的C是变量,应该可以不用引号啊,以前在VB里写表达式c="a" & b,a是字符串,B是变量,变量不用括号的。请教这SQL语句里的双引号单引号和字符串运算符&的具体用法规则,搞了两天头都大了,对象方法不会可以看帮助慢慢找,反而被这标点符号搞晕了头!</P>[em11][em11]
[此贴子已经被作者于2007-7-29 15:30:30编辑过]
|