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

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

ShLooK 19-06-07 15:31

[Asp.Net] בעיה...
 
זה יותר בעיה בC#...
אני מנסה להוסיף עוד רשומה למסד וזה לא עובד...:
קוד:


    protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        //קישור ל-DB
        SqlConnection conn = new SqlConnection(
        ConfigurationManager.ConnectionStrings["dbConnectionString"].ConnectionString);
        conn.Open();
        //להגידר שאילתה ב-SQL
        string DwdID = Request.QueryString["dID"];
        string Date = DateTime.Today.ToString();
        string UserName = User.Identity.Name;
        string SqlStr = "INSERT INTO Comments(CommTitle, CommText, CommDate, DwdNum, WroteBy) VALUES (txtTitle.text, txtText.text, Date, DwdID, UserName)";
        SqlCommand cmd = new SqlCommand(SqlStr, conn);
        conn.Close();
    }


ali_napso 19-06-07 16:44

בדקת את הSQL? ומה הוא מציג לך?

Source 19-06-07 18:00

אממ ממש לא בטוח, אבל נסה:
קוד:

string SqlStr = "INSERT INTO Comments(CommTitle, CommText, CommDate, DwdNum, WroteBy) VALUES ('" & txtTitle.text & "', '" & txtText.text & "', '" & Date & "', '" & DwdID & "', '" & UserName & "')";
אם אופרטור השרשור הוא &, אני לא יודע C# / ASP.Net
(שיניתי שיהיה שרשור למשתנים וגרשים - ' מסביב למחרוזות, למרות שלDwdID מן הסתם לא צריך כי זה מספר אז אתה יכול להוריד שם)


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

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