Monday, February 27, 2012

Help!

Heres my code:

<%
If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood")) = True then
'Redirect to unathorised user page
Response.Redirect"unauthorised_user.asp"
End If
%>
<font size="4">GoldFish Games News Admin</font>
<br><a href="http://links.10026.com/?link=admin_main.asp"><b>Main</b></a> - 
<%
'Dimension variables
Dim adoCon
Dim rs
Dim strSQL

strUserName = Request.Querystring("name")

Set adoCon = Server.CreateObject("ADODB.Connection")

adoCon.open = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=n1i2c3k4; DBQ=" & Server.MapPath("news.mdb")

Set rs = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT tblUsers.Level FROM tblUsers WHERE tblUsers.Username="" & strUserName & """

rs.Open strSQL, adoCon

if rs("Level") = 2 Then
%>
<a href="http://links.10026.com/?link=delete_user_page.asp?name=<% =strUserName %>">Delete User</a> - <a href="http://links.10026.com/?link=add_user_form.asp?name=<% =strUserName %>">Add User</a> - <a href="http://links.10026.com/?link=delete_news_page.asp?name=<% =strUserName %>">Delete News</a> - 
<%
Else
End if
%>
<a href="http://links.10026.com/?link=add_news_form.asp?name=<% =strUsername %>">Add News</a>
 - 
<a href="http://links.10026.com/?link=edit_news_page.asp?name=<% =strUsername %>">Edit News</a>
 - 
<hr>

there is probly a lot of other errors but right now I get this error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/gfgames/db/news/menu.asp, line 25

Does anyone know what the problem is?

--My database is in the right place and linked correctlyLooks like you used double quotes where you need single quotes:

strSQL = "SELECT tblUsers.Level FROM tblUsers WHERE tblUsers.Username='" & strUserName & "'"

will get the job done.

No comments:

Post a Comment