public static void StoreGrid(ICAUploadDAO result)
{
string queryString = "INSERT INTO Result (ModuleGrp, PEM, AdmNo, Name, ICA1, ICA2, ICA3, ICA4, ModuleCode) values ('" + @result.ModuleGrp + "','" + @result.PEM + "','" + @result.AdmNo + "','" + @result.Name + "','" + @result.ICA1 + "','" + @result.ICA2 + "','" + @result.ICA3 + "','" + @result.ICA4 + "','" + @result.ModuleCode + "')";
string connectionString = Properties.Settings.Default.DBConnection;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
command.ExecuteNonQuery();
}
}
我想在插入之前检查该行是否已经存在,如果存在则想更新它。如果有人能帮我解决这个问题,我将不胜感激,因为我不知道该怎么做。太感谢了