public static void AddInfo(info info) { string query = string.Format(@"Insert into Reviews Values ({0}, {1}, {2}, '{3}', '{4}')", info.reviewID, info.userID, info.gameID, info.reviewContent, info.reviewDate); cmd = new SqlCommand(query, cn); try { cn.Open(); cmd.ExecuteNonQuery(); } finally { cn.Close(); } }
protected void saveButt_Click(object sender, EventArgs e) { try { int reviewIDBTN = Convert.ToInt32(reviewIDbox.Text); int userIDBTN = Convert.ToInt32(userIDbox.Text); int gameIDBTN = Convert.ToInt32(gameIDbox.Text); string reviewContentBTN = reviewContentbox.Text; string reviewDateBTN = reviewDatebox.Text; info infoSaveBTN = new info(reviewIDBTN, userIDBTN, gameIDBTN, reviewContentBTN, reviewDateBTN); ConnectionClass.AddInfo(infoSaveBTN); saveStatus.Text = "Uploaded Successfully!"; } catch { saveStatus.Text = "Upload Failed!"; } }