Sub InitAgentCbo(UserCode As Variant)
Dim rsthis As rdoResultset
Dim strSql As String
Dim i As Long
If UserCode = "所有代理" Then
strSql = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent order by agent.AGENTNAME"
Else
strSql = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent where HandleMan ='" & UserCode & "' order by agent.AGENTNAME"
End If
Set rsthis = G_Connection.OpenResultset(strSql, rdOpenKeyset, rdConcurRowVer, rdExecDirect)
cboAgent.Clear
cboAgentMate.Clear
While Not rsthis.EOF
cboAgent.AddItem MF_Null2Emp(rsthis(0))
cboAgentMate.AddItem MF_Null2Emp(rsthis(1))
rsthis.MoveNext
Wend
rsthis.CloseEnd Sub
这是一个模块里面的SUB过程,然后在FORM_load里面调用没有问题然后我又添加了一段代码
Sub InitContinent(continentCode As Variant)
Dim rsthis1 As rdoResultset
Dim strSql2 As String
Dim i1 As Long If continentCode = "所有洲" Then
strSql2 = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent order by agent.AGENTNAME"
Else
strSql2 = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent where continent '" & continentCode & "' order by agent.continent"
End If Set rsthis1 = G_Connection.OpenResultset(strSql, rdOpenKeyset, rdConcurRowVer, rdExecDirect)
cboCotinent.Clear While Not rsthis1.EOF
choContinent.AddIten MF_Null2Emp(rsthis1(1)) rsthis1.MoveNext
Wend
rsthis1.CloseEnd Sub再在form_load里面调用
然后运行时候提示不允许SQL字符串
我不知道错在哪里,帮我分析一下可以么,谢谢
Dim rsthis As rdoResultset
Dim strSql As String
Dim i As Long
If UserCode = "所有代理" Then
strSql = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent order by agent.AGENTNAME"
Else
strSql = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent where HandleMan ='" & UserCode & "' order by agent.AGENTNAME"
End If
Set rsthis = G_Connection.OpenResultset(strSql, rdOpenKeyset, rdConcurRowVer, rdExecDirect)
cboAgent.Clear
cboAgentMate.Clear
While Not rsthis.EOF
cboAgent.AddItem MF_Null2Emp(rsthis(0))
cboAgentMate.AddItem MF_Null2Emp(rsthis(1))
rsthis.MoveNext
Wend
rsthis.CloseEnd Sub
这是一个模块里面的SUB过程,然后在FORM_load里面调用没有问题然后我又添加了一段代码
Sub InitContinent(continentCode As Variant)
Dim rsthis1 As rdoResultset
Dim strSql2 As String
Dim i1 As Long If continentCode = "所有洲" Then
strSql2 = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent order by agent.AGENTNAME"
Else
strSql2 = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent where continent '" & continentCode & "' order by agent.continent"
End If Set rsthis1 = G_Connection.OpenResultset(strSql, rdOpenKeyset, rdConcurRowVer, rdExecDirect)
cboCotinent.Clear While Not rsthis1.EOF
choContinent.AddIten MF_Null2Emp(rsthis1(1)) rsthis1.MoveNext
Wend
rsthis1.CloseEnd Sub再在form_load里面调用
然后运行时候提示不允许SQL字符串
我不知道错在哪里,帮我分析一下可以么,谢谢
If continentCode = "所有洲" Then
strSql2 = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent order by agent.AGENTNAME"
Else
strSql2 = "SELECT agent.AGENTNAME, agent.AGENTCODE FROM agent where continent '" & continentCode & "' order by agent.continent"
End Ifwhere 后少了=