0
我有問題通過使用Npgsql的datagridview更新我的數據。我想從datagridview動態更新我的表。更新不能從datagridview使用npgsql
這裏是我的代碼更新:
NpAdapter.UpdateCommand = new NpgsqlCommand("update sessions set \"Visit Number:\" = :visit_num, \"ID:\" = :id, \"ENTERED BY:\" = :entered " +
"where \"Visit Number:\" = :visit_num_old, \"ID:\" = :id_old, \"ENTERED BY:\" = :entered_old", this.dataconnect);
NpAdapter.UpdateCommand.Parameters.Add(new NpgsqlParameter("visit_num", DbType.Int32, 10) { Direction = ParameterDirection.Input, SourceColumn = "Visit Number:" });
NpAdapter.UpdateCommand.Parameters.Add(new NpgsqlParameter("id", DbType.AnsiStringFixedLength, 50) { Direction = ParameterDirection.Input, SourceColumn = "ID:" });
NpAdapter.UpdateCommand.Parameters.Add(new NpgsqlParameter("entered", DbType.AnsiStringFixedLength, 50) { Direction = ParameterDirection.Input, SourceColumn = "ENTERED BY:" });
NpAdapter.Update(dset, "sessions");
我不知道我做錯了。任何人都可以幫助我。我試圖弄清楚這很長一段時間。