הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   [asp] בעיה עם Request ובסיס נתונים (https://hosts.co.il/forums/showthread.php?t=20136)

Alter 18-04-06 15:18

[asp] בעיה עם Request ובסיס נתונים
 
שלום לכולם
כחלק מהעבודת גמר שלי לבית הספר אני בניתי אתר אינטרנט.
בתוך האתר עבדתי על פאנל ניהול, אך יש לי בעיה עם הקוד.
אני מנסה לעשות עריכה של מידע אך כל פעם שאני מריץ את הסקריפט הוא מציג לי שגיאה לא ברורה

את הקוד ניתן לראות בקישור:
http://magshim.com/admin_links_edit.asp

מגיעים אל הדף דרך הדף:
http://magshim.com/admin_links.asp

הוא מופנה לדף השני כך:
admin_links_edit.asp?idl=24
(במידה והid של אותו אחד הוא 24 באמת..)
עבדתי עם השורה:
set ida = Request("idl")

על מנת להוציא את הidl מהשורת כתובות וכך הוא מציג לי בתיבות טקסט את המידע , אחר כך הוא מופנה לעריכה.

בקיצור השגיאה היא כאשר אני לוחץ על הכפתור עריכה:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'id ='.
/admin/admin_links_edit.asp, line 21

ששאלתי את המורה שלי מה עושים היא אמרה שהשורה שאני קורא לidl היא לא נכונה..
ושהשורת sql גם שגוייה.
אשמח לעזרה בנושא .
אם אתם צריכים עוד מידע, או רוצים לראות את האתר רץ (אין לי שרת מריץ asp והמחשב לא נותן גישה מרחוק..) ואם יש לכם iis במחשב אין לי בעיה להעביר אליכם את הקובץ.
תודה מראש, רון אלטר.

somebody 18-04-06 15:24

לא עושים SET ID
תמחק את ה SET.
ודרך אגב עדייף לכתוב לאיזה REQUEST אתה מתכוון, זאת אומרת FORM/QUERYSTRING וכו..
כי אם אתה לא מציין הוא בודק את כל הדרים עד שהוא מגיע למשתנה בשם שאתה מחפש באחד מהם.
אצלך זה
request.querystring

Alter 18-04-06 15:26

ציטוט:

נכתב במקור על ידי somebody
לא עושים SET ID
תמחק את ה SET.

אותה שגיאה.
אני יודע שלא עושים set, רציתי לראות אם המורה שמה לב לזה , היא לא :-D

השגיאה בקוד מלא
קוד:

The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.

--------------------------------------------------------------------------------

Please try the following:

Click the Refresh button, or try again later.

Open the localhost home page, and then look for links to the information you want.
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'id ='.
/admin/admin_links_edit.asp, line 21


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)

Page:
POST 58 bytes to /admin/admin_links_edit.asp

POST Data:
name=%F2%EE%E5%E3+%F8%E0%F9%E9&link=main.html&edit=editing

Time:
‏יום שלישי ‏18 ‏אפריל ‏2006, 16:26:04


More information:
Microsoft Support


somebody 18-04-06 15:29

תביא את שורה 21+ 3 שורות מעליה+3 שורות מתחיתה.

Alter 18-04-06 15:32

כל הasp:

קוד:

<%
set c=Server.CreateObject("adodb.connection")
set r=Server.CreateObject("adodb.recordset")
c.connectionString="provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &Server.MapPath("\..\db.mdb") & ""
c.open
ida = Request.QueryString("idl")
set rst=c.execute("select * from links where id = " & ida)
response.write("<form action='admin_links_edit.asp' method='POST' name='edit'>")
response.write("<font class='text'>שם הדף:</font>")
response.write("<input type='text' name='name' maxlength='50' size='20' value='"& rst.fields("name") &"' class='textBoxSmall'><br><br>")
response.write("<font class='text'>קישור לדף:</font>")
response.write("<input type='text' name='link' maxlength='255' size='50' value='"& rst.fields("link") &"' class='textBoxSmall'><br><br>")
response.write("<input type='submit' value='שליחה' class='textBoxSmall'><input type='hidden' name='edit' value='editing'>")
response.write("</form>")

action = request("edit")
if action = "editing" Then
        set ida = Request("idl")
        c.execute("update links set `name` = '"&request.form("name")&"' , `link` = '"&request.form("link")&"' where id=" & ida)
end if
c.close
Set c=nothing
Set r=nothing
Set rst=nothing
%>

כאשר שורה 21 היא:
set rst=c.execute("select * from links where id = " & ida)

הבעיה היא עם ההגדרה של הwhere בselect.
את הRequest. סידרתי .
הפכתי את השורה ל
PHP קוד:

ida Request.QueryString("idl"

לפני זה לא היהQueryString, עשיתי את זה כי המורה רשמה לי במייל:
קוד:

You can't write just Request, this is an object and you must use one of his properties or methods, like Request.form or Request.QueryString and so on.

somebody 18-04-06 15:42

תיראה.
בשורה ה 4 אתה לא צריך לכתוב

c.connections
אלא רק connections

ואז אתה כותב:
c.open connections

ואז תיראה שהבעיה היא לא ב SQL אלא בצורת הפתיחה של ההתחברות למסד.

Alter 18-04-06 15:51

ציטוט:

נכתב במקור על ידי somebody
תיראה.
בשורה ה 4 אתה לא צריך לכתוב

c.connections
אלא רק connections

ואז אתה כותב:
c.open connections

ואז תיראה שהבעיה היא לא ב SQL אלא בצורת הפתיחה של ההתחברות למסד.

השינוי הזה לא עשה שום שינוי, ככה או ככה זה עובד ועושה את אותו הדבר.
השגיאה עדיין קיימת.
האם הדרך בחירה שלי בselect נכונה בכלל?

("select * from links where id = " & ida)

somebody 18-04-06 16:28

כן זה נכון.
נסה שניה להוציא את זה מהסוגריים.

Alter 18-04-06 16:32

Expected end of statement

אין סיכוי שזה ירוץ בלי הסוגריים
הם חייבים לתחום את זה.

somebody 18-04-06 16:40

מי אמר לך את השטויות האלו?
אני בחיים לא תוחם בסוגריים.
לא יודע בשפות אחרות, ב ASP לא חייב.
תעשה בסוף המשפט SQL(אחרי הזנת הנתונים):
""&


כל הזמנים הם GMT +2. הזמן כעת הוא 20:28.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ