בעייה בתוכנית בASP - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

בעייה בתוכנית בASP


Ameralis Zaiir

Recommended Posts

שלום לכם,

אני עושה פרוייקט לבגרות בשפת ASP, ויש לי בעייה בממשק המנהל שבניתי, שלא עובד.

זה אמור לעשות תפריט ניהול שמאפשר למחוק משתמשים ולמחוק מנהלים מהמערכת, והוא באמת מראה, ועושה רשימה של כל המנהלים וכל המשתמשים.

אבל ברגע שאני לוחץ על Submit, זה מביא אותי למסך ריק.

אני כבר נואש.

תודה מראש,

Ameralis Zaiir

קוד המקור:

<%

Response.Buffer = True

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

oConn.open "Driver={Microsoft Access Driver (*.mdb)};" &_

"Dbq=G:\Inetpub\wwwroot\LIOR\db1.mdb;" &_

"uid=admin;" &_

"Pwd=;"

dim action

action =Request.Form("action")

If Not IsEmpty(action) Then

If action = "deleteuser" Then

oConn.Execute ("Delete tbl_lakohot WHERE username='"& Request.Form("name")&"'")

Response.Write "<h1> המשתמש נמחק בהצלחה </h1>"

BuildMain()

End If

If action = "deletedirector" Then

oConn.Execute ("Delete tbl_director WHERE username='"& Request.Form("name")&"'")

Response.Write "<h1> המנהל נמחק בהצלחה </h1>"

BuildMain()

End If

Else

BuildMain()

End If

Function BuildMain()

%>

<html dir = "rtl">

<head>

<style>img{Border-Color:blue}</style>

<title> lior12 </title>

</head>

<body background="bahar.jpg">

<center>

<font color = "white">

<h1>

<hr>

<marquee direction=right width=450>מסך ניהול</marquee>

<hr>

</h1>

</font>

</center>

<form method = "post">

<h3>

<input type = "hidden" name = "action" value = "deleteser"/>

<select name = "name">

<%

Set RS = oConn.Execute ("SELECT * FROM tbl_lakohot")

Do While Not RS.EOF

Response.Write ("<option value=" & RS.Fields("username") & ">" & RS.Fields("username") & "</option>")

RS.MoveNext

Loop

RS.Close

Set RS = Nothing

%>

</select>

<input type="submit" value = "מחק משתמש"/>

</h3>

<form>

<br/>

<form method = "post">

<h3>

<input type = "hidden" name = "action" value = "deletedirector"/>

<select name = "name">

<%

Set RS2 = oConn.Execute ("SELECT * FROM tbl_director")

Do While Not RS2.EOF

Response.Write ("<option value=" & RS2.Fields("username") & ">" & RS2.Fields("username") & "</option>")

RS2.MoveNext

Loop

RS2.Close

Set RS2 = Nothing

%>

</select>

<input type="submit" value = "מחק מנהל"/>

</h3>

<form>

</body>

</html>

<%

Response.End

End Function

oConn.Close

Set oConn = Nothing

%>

קישור לתוכן
שתף באתרים אחרים

oConn.Execute ("Delete tbl_lakohot WHERE username='"& Request.Form("name")&"'")

לדעתי הבעיה היא בשורות האלה. אתה פותח גרשיים ראשונים ואז פותח אחרים לפני שאתה סוגר את הראשונים והמנוע ASP חושב שסגרת את הראשונים. (מקווה שהבנת)

אתה יכול לנסות לעשות את זה ככה:

mySQL = "DELETE * FROM tbl_lakohot"

mySQL = mySQL & " WHERE username="

mySQL = mySQL & request.form("name")

oConn.Execute (mySQL)

העתקתי את זה מהאתר שלי ככה שכמעט בטוח שזה עובד.

מקווה שעזרתי.

קישור לתוכן
שתף באתרים אחרים

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

×
  • צור חדש...