 |
|
ขอความช่วยเหลือค่ะ
คือหนูใช้ ASP เขียน และทำระบบ Login กำหนด Access Level ไว้ 3 Status คือ
Level 1 เป็น User (ไม่สามารถแก้ไขใดๆ ได้)
Level 2 เป็น Administrator (แก้ไขได้บางส่วน)
Level 3 เป็น Webmaster ( สามารถ แก้ไข เปลี่ยนแปลงได้เต็มระบบ Back office )
ใช้ฐานข้อมูล Access 2007 ค่ะ
วาง concept คือ
ถ้า level 1 ให้ไปที่ page user1.asp
ถ้า level 2 ให้ไปที่ page administrator1.asp
ถ้า level 3 ให้ไปที่ page webmaster1.asp
ถ้าไม่เลือก หรือใส่ user ,password ผิด ให้ไปที่ page Index.asp
จะเขียน Code ในการ Check Status อย่างรัย และจะรับค่าในการ Check Status นั้นผ่านเพื่อจะไปยังหน้าต่อไปได้อย่างรัยคะ
คือ หนูได้ code มาจากพี่คนนึง ซึ่งติดต่อกับฐานข้อมูล Access 2003
แต่หนูต้องการให้ติดต่อกับฐานข้อมูล Access 2007 ค่ะ ช่วยดู code ด้านล่างให้หน่อยนะคะ
ขอบคุณมากๆๆๆๆ
======================= Start ส่วน connect database ==============================================
<%
Option Explicit
Dim Conn,strSQL,objRec,intRows,rslogin
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("../DBACC/DB_SUTT_V2.accdb") & ";Jet OLEDB:Database Password=sutt242;"
%>
======================= End ส่วน connect database ==============================================
<%
Dim usernames,passwords,level,FirstName,UserName,InchargeID
if request.form("UserName") <> "" And request.Form("Password") <> "" then UserName = request.Form("UserName")
passwords = request.Form("Password")
level = request.Form("level")
strsql = "select * from User where UserName='"& UserName & "' and Password= '"& passwords &"' and level= '"& level &"'"
set rslogin = server.createobject("adodb.recordset")rslogin.open strsql, conn, 1, 2
If Not rslogin.eof Then level = rslogin("level")
session("level") = level 'เก็บค่า level
session("UserName") = rslogin("UserName") 'เก็บค่า username 'ตรวจสอบ level
if level = 1 then response.Redirect("Default_Budgets.asp") elseif level = 2 then response.Redirect("ShowDep_Admin.asp")
elseif level = 3 then response.Redirect("ShowDep_Administrator.asp")
else response.Redirect("Webmaster_ShowAll_Actual.asp")
end if
Else response.Write("<font color=red>! </font><font color=red size=1>UserName,Password and Access Level is wrong</font>")
End if
End if
%>
=== ส่วนที่ code error ===
Error Type:
Microsoft Office Access Database Engine (0x80040E14)
Syntax error in FROM clause.
/sutt_budgets_v.2/Loginform_THAI_V2.asp, line 286
Tag : ASP, Ms Access, VBScript
|
|
 |
 |
 |
 |
Date :
2010-11-03 08:45:27 |
By :
Fhaa |
View :
2252 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |