עבור לתוכן
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.

בעיה עם פקודת SUM בsql שפת C#

Featured Replies

פורסם

אני עושה פרויקט בעיצוב תוכנה, ואני צריך להשתמש בפקודת sum בsql

הבעיה היא שכשאני מנסה למשוך את הנתונים קופצת לי שגיאה במהלך הריצה.

הקוד:

 dataConnection.Open();
datacommand.CommandText = "SELECT SUM(Minutesfromfirststation) FROM tblStations WHERE Line = \'"
+ FinalLines[k] + "\'" + " AND Numofstation > " + Finalindexes[k] + " AND Numofstation < " + Finalindexes2[k];
dataReader = datacommand.ExecuteReader();
timeLetf = dataReader.GetInt32(0) + " דקות";

השגיאה שאני מקבל היא:

No data exists for the row/column.

שאני משתמש בselect וכאלה עוד לא נתקלתי בשגיאות כאלה

וכשעשיתי מעקב ראיתי שהשגיאה קופצת בשורה:

timeLetf = dataReader.GetInt32(0) + " דקות";

אשמח לקבל עזרה..

תודה רבה לכל העוזרים מראש=]

פורסם

כשהשאילתא שלך אמורה להחזיר רק ערך אחד (ולא אוסף של רשומות) אז צריך להשתמש ב-ExecuteScalar במקום ExecuteReader.

בכל מקרה, עם ExecuteReader, לפני שאתה יכול להשתמש ב-reader אתה צריך לקרוא לפחות פעם אחת לפונקציה Read על מנת לגשת לרשומה הראשונה.

ארכיון

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

דיונים חדשים

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.