UPDATE query on Access Database not working C#.NET

前端 未结 2 566
离开以前
离开以前 2021-01-19 18:45

I am working on a database management system. I have a simple task of updating user profile. I created an asp.net page with textboxes and a save button. After adding the tex

2条回答
  •  一向
    一向 (楼主)
    2021-01-19 19:10

    Add the parameter values in the same order as the parameter names appear in the UPDATE statement.

    cmd.Parameters.AddWithValue("@firstName", firstName);
    cmd.Parameters.AddWithValue("@lastName", lastName);
    cmd.Parameters.AddWithValue("@Gender", Gender);
    cmd.Parameters.AddWithValue("@Address", sAddress);
    cmd.Parameters.AddWithValue("@Telephone", sTelephone);
    cmd.Parameters.AddWithValue("@Course", sCourse);
    cmd.Parameters.AddWithValue("@Email", sEmail);
    cmd.Parameters.AddWithValue("@UserName", User.Identity.Name);
    

    OleDb with Access does not pay attention to the parameter names, only their order.

提交回复
热议问题