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

בעיה עם stored procedures

Featured Replies

פורסם

היי,

אני מנסה לעבוד עם STORED PROCEDURES באופן הבא:


SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connection1"].ConnectionString);

try
{
SqlCommand command = new SqlCommand("LogIn", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@User_Name", SqlDbType.NChar, 10).Value = UserName;
command.Parameters.Add("@User_Pass", SqlDbType.NChar, 10).Value = Password;
command.Parameters.Add("@RETURN_VALUE", SqlDbType.Int, 4).Direction = ParameterDirection.ReturnValue;
conn.Open();
try
{
command.ExecuteNonQuery();
ret = (int)command.Parameters["@RETURN_VALUE"].Value;
if (ret >= 0)
myContext.Session["User_Id"] = ret;
else
ret = -1;
}
catch (Exception e)
{
myContext.Session["ERROR"] = e.ToString();
}
finally
{
conn.Dispose();
conn.Close();
}
}
catch (Exception e)
{
myContext.Session["ERROR"] = e.ToString();
}

הבעיה היא שתמיד חוזר לי NULL בשורה הבאה:

command.ExecuteScalar();

ללא קשר למה שהSP החזירה לי באמת. כאשר אני מריץ את הSP מהSQLSERVER עצמו אין בעיה.

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

אודה לכם אם תעזרו לי למצוא אותה.

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

פורסם

אז כרגע זה תקין או שעדיין יש בעיה?

פורסם
  • מחבר

זה עובד בסוף. רשמתי בעריכה.

פורסם

תהפוך את הסדר בבלוק של ה- finaly

ארכיון

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

דיונים חדשים

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.