עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

שגיאה בהתחברות של c# לבסיס נתונים access

Featured Replies

פורסם

שלום,

כתבתי שאילתה פשוטה ששולפת נתונים מאקסס,

ביזמן ריצה מתקבלת לי שגיאה- צרפתי את התצלום מסך של השגיאה.

מצורף קטע תחילת הקוד...

מסומן בסגול השורה בה מפסיקה התוכנית לרוץ.

אודה מאד על עזרה!!

OleDbConnection conn = newOleDbConnection();

conn.ConnectionString= "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\sarimimi\\Desktop\\gibuy\\key.accdb";

conn.Open();

// משתנה המתחבר לבסיס הנתוניםOleDbCommand comm = newOleDbCommand();

comm.Connection = conn;

comm.CommandType = CommandType.Text;

comm.CommandText = "select tz from tbl_man where tz = " + tz_text.Text ;//לפי התז שהוכנסה// הפעלת קריאה לפי הפרמטרים שנרשמו למעלהOleDbDataReader reader;

reader = comm.ExecuteReader();כאן התוכנית עוצרת את הריצה

// reader.Read();

[attachment deleted by admin]

פורסם

ערוך את ההודעה ושים את הקוד בתוך טג קוד (כפתור "הוסף קוד" למעלה) כדי שיהיה קריא.

מה מכיל tz_text?

פורסם

תעודת הזהות נשמרת בDB כמחרוזת או כמספר?

פורסם
  • מחבר

התעודת זהות בבסיס הנתונים מוגדרת כמחרוזת - טקסט.

פורסם

אז זו הבעיה - את משווה אותה למספר. את צריכה לעטוף את הטקסט בגרשיים:

comm.CommandText = "select tz from tbl_man where tz = \'" + tz_text.Text + "\'";

פורסם
  • מחבר

הופה.....

זה עובד!!!

תודה..

אבל לא הבנתי למה אני משווה למספר - הרי זה text.. - לא?!

פורסם

נכון, אבל כשכותבים טקסט את צריכה לעטוף אותו במרכאות. נניח ש-tz_text.Text מכיל את המחרוזת "1234".

אז השאילתא שלך הייתה כזה דבר:

select tz from tbl_man where tz = 1234

ככה ששרת ה-SQL חושב שאת משווה את tz למספר 1234. השאילתא שאת באמת רוצה להריץ היא זו:

select tz from tbl_man where tz = '1234'

באותו אופן, אם tz_text.Text מכיל את המחרוזת "abcd" אז השאילתא תהיה דבר כזה:

select tz from tbl_man where tz = abcd

ודבר כזה לא יעבוד בכלל, כי שרת ה-SQL לא יודע מה זה abcd (הוא מחפש משתנה בשם abcd, וכמובן אין לו כזה).

פורסם
  • מחבר

תודה על ההסבר המפורט..

עזר לי מאד!!

ארכיון

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

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.