CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 Help me for this query in a second for you

Print topic Send  topic

Author Message
enandret
Posted: 05/22/2003, 1:16 AM

Hello, please help me toenandret@libero.it

This is a error:
Microsoft JET Database Engine (0x80040E14)
Errore di sintassi (operatore mancante) nell'espressione della query
'[m].[distretto_id]=.[distretto_id] WHERE (m.[login] like '%ale%' or
m.[nome] like '%ale%' or b.[comune] like '%ale%' or m.[cognome] like
'%ale%')'.

And this is a source code. For me the problem is in the "select" sintax but
I don't find it!!!


Sub utenti_Show()


Dim sWhere
sWhere = ""
sOrder = ""
sSQL = ""


transit_params = "nome=" & ToURL(GetParam("nome")) & "&"
form_params = "nome=" & ToURL(GetParam("nome")) & "&"

sOrder = " order by m.login Asc"
iSort = GetParam("Formutenti_Sorting")
iSorted = GetParam("Formutenti_Sorted")

sDirection = ""
sSortParams = ""
if not IsEmpty(iSort) then
if iSort = iSorted then
form_sorting = ""
sDirection = " DESC"
sSortParams = "Formutenti_Sorting=" & iSort & "&Formutenti_Sorted=" & iSort
& "&"
else
form_sorting = iSort
sDirection = " ASC"
sSortParams = "Formutenti_Sorting=" & iSort & "&Formutenti_Sorted=" & "&"
end if


if iSort = 1 then sOrder = " order by m.[login]" & sDirection
if iSort = 2 then sOrder = " order by m.[nome]" & sDirection
if iSort = 3 then sOrder = " order by m.[cognome]" & sDirection
if iSort = 4 then sOrder = " order by m.[livello]" & sDirection
if iSort = 5 then sOrder = " order by b.[nome]" & sDirection
if iSort = 6 then sOrder = " order by b.[comune]" & sDirection
if IsNull(sOrder) then sDirection = ""
end if


%>
<table style="">
<tr>
<td style="background-color: #60A605; text-align: Center; border-style:
outset; border-width: 1" colspan="14"><a name="utenti"><font
style="font-size: 12pt; color: #FFFFFF; font-weight:
bold">UTENTI</font></a></td>
</tr>
<tr>
<td style="border-style: inset; border-width: 0"><a
href="<%=sFileName%>?<%=form_params%>Formutenti_Sorting=1&Formutenti_Sorted=
<%=form_sorting%>&"><font style="font-size: 10pt; color: #CE7E00;
font-weight: bold">Login</font></a></td>
<td style="border-style: inset; border-width: 0"><a
href="<%=sFileName%>?<%=form_params%>Formutenti_Sorting=2&Formutenti_Sorted=
<%=form_sorting%>&"><font style="font-size: 10pt; color: #CE7E00;
font-weight: bold">Nome</font></a></td>
<td style="border-style: inset; border-width: 0"><a
href="<%=sFileName%>?<%=form_params%>Formutenti_Sorting=3&Formutenti_Sorted=
<%=form_sorting%>&"><font style="font-size: 10pt; color: #CE7E00;
font-weight: bold">Cognome</font></a></td>
<td style="border-style: inset; border-width: 0"><a
href="<%=sFileName%>?<%=form_params%>Formutenti_Sorting=4&Formutenti_Sorted=
<%=form_sorting%>&"><font style="font-size: 10pt; color: #CE7E00;
font-weight: bold">Livello</font></a></td>
<td style="border-style: inset; border-width: 0"><a
href="<%=sFileName%>?<%=form_params%>Formutenti_Sorting=5&Formutenti_Sorted=
<%=form_sorting%>&"><font style="font-size: 10pt; color: #CE7E00;
font-weight: bold">Nome Biblioteca</font></a></td>
<td style="border-style: inset; border-width: 0"><a
href="<%=sFileName%>?<%=form_params%>Formutenti_Sorting=6&Formutenti_Sorted=
<%=form_sorting%>&"><font style="font-size: 10pt; color: #CE7E00;
font-weight: bold">Comune Biblioteca</font></a></td>
</tr><%

sWhere = ""

pnome = GetParam("nome")
if not isEmpty(pnome) then
HasParam = true
sWhere = "m.[login] like '%" & replace(pnome, "'", "''") & "%'" & " or " &
"m.[nome] like '%" & replace(pnome, "'", "''") & "%'" & " or " & "b.[comune]
like '%" & replace(pnome, "'", "''") & "%'" & " or " & "m.[cognome] like '%"
& replace(pnome, "'", "''") & "%'"
end if

if HasParam then sWhere = " WHERE (" & sWhere & ")"

' Crea la query sql per la ricerca utenti

sSQL = "select [m].[nome] as m_nome, " & _
"[m].[cognome] as m_cognome, " & _
"[m].[utente_id] as m_utente_id, " & _
"[m].[livello] as m_livello, " & _
"[m].[distretto_id] as m_distretto_id, " & _
"[m].[login] as m_login, " & _
".[distretto_id] as b_distretto_id, " & _
".[nome] as b_nome, " & _
".[comune] as b_comune " & _
"from [utenti] m, [distretti] b " & _
"where [m].[distretto_id]=.[distretto_id] "

sSQL = sSQL & sWhere & sOrder
form_action = "AmmGestioneUtenti.asp"

iPage = GetParam("Formutenti_Page")
if IsEmpty(iPage) then iPage = 1

' Apre recordset
openrs rs, sSQL

if rs.eof then
' Recordset vuoto
%>
<tr>
<td colspan="4" style="border-width: 1"><font style="font-size: 10pt; color:
#000000">Nessun elemento</font></td>
</tr><%

else
iCounter = 0
while not rs.eof and iCounter < (iPage-1)*20
rs.movenext
iCounter = iCounter + 1
wend
iCounter = 0
end if


alivello = Split("1;Utente;2;Amministratore", ";")

' Visualizza tabella con risultati
while not rs.EOF and iCounter < 20
fldlogin = GetValue(rs, "m_login")
fldnome = GetValue(rs, "m_nome")
fldcognome = GetValue(rs, "m_cognome")
fldlivello = GetValue(rs, "m_livello")
fldnomebiblio = GetValue(rs, "b_nome")
fldcomune = GetValue(rs, "b_comune")
%>
<tr>
<td style="border-width: 1"><font style="font-size: 10pt; color: #000000"><a
href="AmmUtentiInfo.asp?utente_id=<%= ToURL(GetValue(rs,
"m_utente_id"))%>&<%=transit_params%>"><font style="font-size: 10pt; color:
#000000"><%=ToHTML(fldlogin)%></font></a> </font></td>
<td style="border-width: 1"><font style="font-size: 10pt; color:
#000000"><%=ToHTML(fldnome)%> </font></td>
<td style="border-width: 1"><font style="font-size: 10pt; color:
#000000"><%=ToHTML(fldcognome)%> </font></td>
<td style="border-width: 1"><font style="font-size: 10pt; color:
#000000"><%fldlivello = getValFromLOV(fldlivello,
alivello)%><%=ToHTML(fldlivello)%> </font></td>
<td style="border-width: 1"><font style="font-size: 10pt; color:
#000000"><%=ToHTML(fldnomebiblio)%> </font></td>
<td style="text-align: Center; border-width: 1"><font style="font-size:
10pt; color: #000000"><%=ToHTML(fldcomune)%> </font></td>
</tr><%

rs.MoveNext

iCounter = iCounter + 1
wend


%>
<tr><td colspan="4" style="border-style: inset; border-width: 0"><font
style="font-size: 10pt; color: #CE7E00; font-weight: bold">
<a href="<%= form_action %>?<%= transit_params %>"><font style="font-size:
10pt; color: #CE7E00; font-weight: bold">Inserisci nuovo utente</font></a>
<%

if not rs.EOF or not iPage=1 then
if iPage = 1 then
scroller_prev = "<a
href_="""&sFileName&"?"&form_params&sSortParams&"Formutenti_Page="&prev_page
&"#utenti"">"
else
prev_page = iPage - 1
scroller_prev = "<a
href="""&sFileName&"?"&form_params&sSortParams&"Formutenti_Page="&prev_page&
"#utenti"">"
end if
%>
<%=scroller_prev%><font style="font-size: 10pt; color: #CE7E00; font-weight:
bold">Precedente</font>
<%
if not IsNull(scroller_prev) then response.write "</a>"

response.write " [ "&iPage&" ] "

if rs.EOF then
scroller_next = "<a
href_="""&sFileName&"?"&transit_params&sSortParams&"Formutenti_Page="&next_p
age&"#utenti"">"
else
next_page = iPage + 1
scroller_next = "<a
href="""&sFileName&"?"&transit_params&sSortParams&"Formutenti_Page="&next_pa
ge&"#utenti"">"
end if

%>
<%=scroller_next%><font style="font-size: 10pt; color: #CE7E00; font-weight:
bold">Successiva</font>
<%

if not IsNull(scroller_next) then response.write("</a>")
end if

set rs = nothing

%>
</font></td></tr>
</table>
<%

end sub

%>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.