CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 help me for this query is a second for you

Print topic Send  topic

Author Message
enandret
Posted: 05/22/2003, 1:20 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

%>

DonB
Posted: 05/22/2003, 6:59 PM

I am not certain if access will allow table alias without using the "AS"
keyword ([utenti] AS m). Please try that and see if it helps.

You might also try putting Response.Write sSQL into the code to display the
SQL statement that is being executed. You can cut and paste this into
Access as a Querydef to see if you get a more specific error message
directly from Access..

DonB


"enandret" <enandret@libero.it> wrote in message
news:bai18i$reo$1@news.codecharge.com...
> 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
>
> %>
>
>

enandret
Posted: 05/23/2003, 12:07 AM

Thanks for yours attention..the problem isn't the command AS because access
allow the sintax that I have use.

I have resolve the problem.

Sorry for my english but...I'm italian and in italy...

Now I have a new and last question that I ask to you but I have to necessity
for graduate:

So, I would to like that an administrator can able and disable accounts by
check a button or by a listbox (naturally I must use a database access with
a table users with list of users, login, password and than I would like to
add a able/disable account check).

I have improve to modify the page Login.asp but I have many problems to do..

Naturally I'm able to modify the page that Administrator use to check the
user able/disable

There is any solution to do this??

This is the code of procedure that is in the file Login.asp

<%

'***************************************************************************
*****

'Procedura controllo login e password



Sub LoginAction(sAction)

Select case sAction

Case "login"

' Richiesta Login


sLogin = GetParam("Login")

sPassword = GetParam("Password")

bPassed = CLng(DLookUp("utenti", "count(*)", "login =" & ToSQL(sLogin,
"Text") & " and password=" & ToSQL(sPassword, "Text")))


if bPassed > 0 then

' Controllo login e password

Session("UserID") = CStr(DLookUp("utenti", "utente_id", "login =" &
ToSQL(sLogin, "Text") & " and password=" & ToSQL(sPassword, "Text")))

Session("UserRights") = CLng(DLookUp("utenti", "livello", "login =" &
ToSQL(sLogin, "Text") & " and password=" & ToSQL(sPassword, "Text")))

sQueryString = GetParam("querystring")

sPage = GetParam("ret_page")

if not(sPage = request.serverVariables("SCRIPT_NAME")) and
not(isEmpty(sPage)) then

response.redirect(sPage & "?" & sQueryString)

end if


response.redirect("default.asp")

else

sLoginErr = "<font color=#FF0000>Login o Password non corretti.</font><br>"

end if


Case "logout"

' Richiesta logout


Session("UserID") = Empty

Session("UserRights") = Empty

response.redirect("Login.asp")


End Select

End Sub

%>



Please help me for the last time!!!!!

Enzo

"DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> ha scritto nel messaggio
news:bajv9n$23d$1@news.codecharge.com...
> I am not certain if access will allow table alias without using the "AS"
> keyword ([utenti] AS m). Please try that and see if it helps.
>
> You might also try putting Response.Write sSQL into the code to display
the
> SQL statement that is being executed. You can cut and paste this into
> Access as a Querydef to see if you get a more specific error message
> directly from Access..
>
> DonB
>
>
> "enandret" <enandret@libero.it> wrote in message
>news:bai18i$reo$1@news.codecharge.com...
> > 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
> >
> > %>
> >
> >
>
>

DonB
Posted: 05/23/2003, 5:43 PM


You probably have a "table" as the datasource for the login form. Change
that to a query, one that includes something like "WHERE NOT
login_disabled". Now you will validate logins against ONLY the users that
are enabled.. This does not require you to do anything in code.

You might even want to add another term to the WHERE, something like "OR
userid = 'administrator'". This will prevent the administrator from
accidently disabling himself.

DonB


"enandret" <enandret@libero.it> wrote in message
news:bakhcc$87m$1@news.codecharge.com...
> Thanks for yours attention..the problem isn't the command AS because
access
> allow the sintax that I have use.
>
> I have resolve the problem.
>
> Sorry for my english but...I'm italian and in italy...
>
> Now I have a new and last question that I ask to you but I have to
necessity
> for graduate:
>
> So, I would to like that an administrator can able and disable accounts by
> check a button or by a listbox (naturally I must use a database access
with
> a table users with list of users, login, password and than I would like to
> add a able/disable account check).
>
> I have improve to modify the page Login.asp but I have many problems to
do..
>
> Naturally I'm able to modify the page that Administrator use to check the
> user able/disable
>
> There is any solution to do this??
>
> This is the code of procedure that is in the file Login.asp
>
> <%
>
>
'***************************************************************************
> *****
>
> 'Procedura controllo login e password
>
>
>
> Sub LoginAction(sAction)
>
> Select case sAction
>
> Case "login"
>
> ' Richiesta Login
>
>
> sLogin = GetParam("Login")
>
> sPassword = GetParam("Password")
>
> bPassed = CLng(DLookUp("utenti", "count(*)", "login =" & ToSQL(sLogin,
> "Text") & " and password=" & ToSQL(sPassword, "Text")))
>
>
> if bPassed > 0 then
>
> ' Controllo login e password
>
> Session("UserID") = CStr(DLookUp("utenti", "utente_id", "login =" &
> ToSQL(sLogin, "Text") & " and password=" & ToSQL(sPassword, "Text")))
>
> Session("UserRights") = CLng(DLookUp("utenti", "livello", "login =" &
> ToSQL(sLogin, "Text") & " and password=" & ToSQL(sPassword, "Text")))
>
> sQueryString = GetParam("querystring")
>
> sPage = GetParam("ret_page")
>
> if not(sPage = request.serverVariables("SCRIPT_NAME")) and
> not(isEmpty(sPage)) then
>
> response.redirect(sPage & "?" & sQueryString)
>
> end if
>
>
> response.redirect("default.asp")
>
> else
>
> sLoginErr = "<font color=#FF0000>Login o Password non
corretti.</font><br>"
>
> end if
>
>
> Case "logout"
>
> ' Richiesta logout
>
>
> Session("UserID") = Empty
>
> Session("UserRights") = Empty
>
> response.redirect("Login.asp")
>
>
> End Select
>
> End Sub
>
> %>
>
>
>
> Please help me for the last time!!!!!
>
> Enzo
>
> "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> ha scritto nel messaggio
>news:bajv9n$23d$1@news.codecharge.com...
> > I am not certain if access will allow table alias without using the "AS"
> > keyword ([utenti] AS m). Please try that and see if it helps.
> >
> > You might also try putting Response.Write sSQL into the code to display
> the
> > SQL statement that is being executed. You can cut and paste this into
> > Access as a Querydef to see if you get a more specific error message
> > directly from Access..
> >
> > DonB
> >
> >
> > "enandret" <enandret@libero.it> wrote in message
> >news:bai18i$reo$1@news.codecharge.com...
> > > 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.

Web Database

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.