Mysql更新查询不起作用。表格数据没有变化。我使用MySql和C#。我的表格字段是:
username,
password,
name,
Loggedin
代码:
try
{
string userlogout = "UPDATE UsersTable SET Loggedin = '0' WHERE username = '" + txtlogoutusername.Text+ "' ";
obj.cmd.Connection = obj.conn;
obj.cmd.CommandText = userlogout;
obj.cmd.ExecuteNonQuery();
userpanel.Visible = false;
}
catch (Exception ex)
{
MessageBox.Show("" + ex);
}
答案 0 :(得分:1)
App.config上的连接字符串
public Manager GetManager(string aspNetUserId)
{
var manager = _db.Managers
.Include(p => p.EmailAccount)
.Where(p => p.AspNetUser.Id == aspNetUserId)
.FirstOrDefault();
return manager;
}
检查您的选择语句
<connectionStrings>
<add name ="con_str" connectionString="~~~~~your connection string~~~~~~~~~~~"/>
</connectionStrings>