הכנסת נתונים באמצעות לולאה אני מנסה להכניס נתונים למסד, שנשלחים מטופס בלולאת for Each.. כך: For Each item in Request.Form rsUser("item") = Request.Form(item)
next
השגיאה: Item cannot be found in the collection corresponding to the requested name or ordinal
הבנתי את הבעיה, הוא מחפש בטבלה שדה בשם item ולא מוצא. איך אפשר לעשות שה- item יקַרֵא כמשתנה?
if car="all" then car = "" end if if model= 0 then model = "" end if if area="all" then area = "" end if if k<>"" and g<>"" then ad=" and pri BETWEEN "& k &" and "& g &"" else ad="" end if response.write model & area Set rs = Server.CreateObject("ADODB.Recordset") SQL_query = "Select * from bla where car like "& car &" and model like "& model &" and area like '%"& area &"%' "&ad&" order by bold, time DESC" rs.Open SQL_query, conn, 3, 3
והשגיאה היא:
Syntax error (missing operator) in query expression car like "& car &" and model like "& model &" and area like '%"& area &"%'
יש לציין שאם אני מחפש שהcar לא שווה all וmodel לא שווה 0 אז זה כן עובד, ואם area לא שווה all, אבל אם car או model שווים ל- all ו-0 ו-area לא שווה לall, זה גם לא עובד..(מקווה שלא הסתבכם). מישהו יודע מה הבעיה?? ניסיתי מלא דברים ולא עובד, תודה מראש
אלה מספרים, ו.. car וmodel אלה מספרים, בגלל זה אין גרשיים. car שווה לall כשאר המשתמש בוחר "כל הרכבים", וmodel שווה ל0 שהמשתמש בוחר כל הדגמים.. ה- "&ad&", זה: if k<>"" and g<>"" then ad=" and pri BETWEEN "& k &" and "& g &"" else ad="" end if
שכמובן נמצא לפני הקוד שכתבתי מקודם, גם זה מספרים..
נראה לי שהבנתי את הבעיה, אבל.. נראה לי שהבנתי מה הבעיה, בעצם יוצא שבסוף השאילתא נראית כך: SQL_query = "Select * from bla where car like and model like and area like '%"& area &"%' "&ad&" order by bold, time DESC"
אני רוצה שאם המתמש יבחר all או 0 אז יוצגו לו כל התוצאות.. איך עושים את זה?
10 תשובות
אפשרות
אני לא מכיר את האקסס אבל נסה להעתיק את הקובץ (כשאף אחד לא מחובר אליו) להוסיף לשם הקובץ חותמת זמן ויש לך גיבוי יומי
הכנסת נתונים באמצעות לולאה
אני מנסה להכניס נתונים למסד, שנשלחים מטופס בלולאת for Each..
כך:
For Each item in Request.Form
rsUser("item") = Request.Form(item)
next
השגיאה:
Item cannot be found in the collection corresponding to the requested name or ordinal
הבנתי את הבעיה, הוא מחפש בטבלה שדה בשם item ולא מוצא.
איך אפשר לעשות שה- item יקַרֵא כמשתנה?
תודה מראש
ככה אולי?
rsUser(item) = Request.Form(item)
בהנחה ששם השדה זהה לשם האלמנט מהטופס
תודה רבה!!
חיפוש
בניתי חיפוש,
כך:
car=request("car")
model=request("model")
area=request("area")
k=request("prik")
g=request("prig")
if car="all" then
car = ""
end if
if model= 0 then
model = ""
end if
if area="all" then
area = ""
end if
if k<>"" and g<>"" then
ad=" and pri BETWEEN "& k &" and "& g &""
else
ad=""
end if
response.write model & area
Set rs = Server.CreateObject("ADODB.Recordset")
SQL_query = "Select * from bla where car like "& car &" and model like "& model &" and area like '%"& area &"%' "&ad&" order by bold, time DESC"
rs.Open SQL_query, conn, 3, 3
והשגיאה היא:
Syntax error (missing operator) in query expression car like "& car &" and model like "& model &" and area like '%"& area &"%'
יש לציין שאם אני מחפש שהcar לא שווה all וmodel לא שווה 0 אז זה כן עובד, ואם area לא שווה all, אבל אם car או model שווים ל- all ו-0 ו-area לא שווה לall, זה גם לא עובד..(מקווה שלא הסתבכם).
מישהו יודע מה הבעיה?? ניסיתי מלא דברים ולא עובד,
תודה מראש
חסר גרשים…
מסביב לערך שאתה משווה את car ואת model.
חוצמזה, מה זה ה "&ad&" הזה לפני ה order by?
אלה מספרים, ו..
car וmodel אלה מספרים, בגלל זה אין גרשיים.
car שווה לall כשאר המשתמש בוחר "כל הרכבים", וmodel שווה ל0 שהמשתמש בוחר כל הדגמים..
ה- "&ad&", זה:
if k<>"" and g<>"" then
ad=" and pri BETWEEN "& k &" and "& g &""
else
ad=""
end if
שכמובן נמצא לפני הקוד שכתבתי מקודם, גם זה מספרים..
תודה מראש
נראה לי שהבנתי את הבעיה, אבל..
נראה לי שהבנתי מה הבעיה, בעצם יוצא שבסוף השאילתא נראית כך:
SQL_query = "Select * from bla where car like and model like and area like '%"& area &"%' "&ad&" order by bold, time DESC"
אני רוצה שאם המתמש יבחר all או 0 אז יוצגו לו כל התוצאות..
איך עושים את זה?
תיקון..
השאילתא כך:
SQL_query = "Select * from adicar where car = "&car&" and model = "&model&" and area like '%"& area &"%' "&ad&" order by bold, time DESC"
הסתדרתי, תודה