C# 및 db 프로그래밍에 익숙하지 않습니다. 그리고 다른 사람의 코드를 인계했습니다. DB를 업데이트하려고 할 때 오류가 발생합니다. 여기 코드는 다음과 같습니다DB 오류 받기 : 조건 식의 데이터 형식이 일치하지 않습니다. C#
private void EnableEvent(int eventID)
{
OleDbCommand oleCMD = new OleDbCommand();
oleCMD.Connection = Database.SqlConn();
OleDbTransaction oleTrans = oleCMD.Connection.BeginTransaction();
oleCMD.Transaction = oleTrans;
try
{
StringBuilder sql = new StringBuilder();
sql.AppendFormat("UPDATE Events SET isActive = 1 where EventID='{0}'", eventID);
oleCMD.CommandText = sql.ToString();
// insert the header
oleCMD.ExecuteNonQuery();
oleTrans.Commit();
}
catch(Exception e)
{
MessageBox.Show(e.Message, "Database Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
finally
{
oleCMD.Connection.Close();
oleCMD.Dispose();
}
}
전체 오류 문자열을 게시 할 수 있습니까? – raym0nd
더 이상 오류 문자열을 얻으려면 어떻게해야합니까? e.message가 "조건 식의 데이터 형식 불일치"입니다. – Matt