public string updatePriority_info(Priority_info x) { string connectionString = this.Connect(); string str2 = ""; SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = "UPDATE [dbo].[priority_info] SET [countryID] ='" + x.countryID + "',[app_no] = '" + x.app_no + "',[xdate] = '" + x.xdate + "', "; command.CommandText += " [log_staff] = '" + x.log_staff + "',[xvisible] = '" + x.xvisible + "' WHERE xID ='" + x.xID + "' "; connection.Open(); str2 = command.ExecuteNonQuery().ToString(); connection.Close(); return str2; }
public string addPriority_info(Priority_info c_pri) { string connectionString = this.Connect(); string succ = ""; SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = "INSERT INTO priority_info (countryID,app_no,xdate,log_staff,xvisible) VALUES (@countryID,@app_no,@xdate,@log_staff,@xvisible) SELECT SCOPE_IDENTITY()"; connection.Open(); command.Parameters.Add("@countryID", SqlDbType.VarChar, 50); command.Parameters.Add("@app_no", SqlDbType.VarChar); command.Parameters.Add("@xdate", SqlDbType.VarChar, 50); command.Parameters.Add("@log_staff", SqlDbType.VarChar, 20); command.Parameters.Add("@xvisible", SqlDbType.VarChar, 10); command.Parameters["@countryID"].Value = c_pri.countryID; command.Parameters["@app_no"].Value = c_pri.app_no; command.Parameters["@xdate"].Value = c_pri.xdate; command.Parameters["@log_staff"].Value = c_pri.log_staff; command.Parameters["@xvisible"].Value = c_pri.xvisible; succ = command.ExecuteScalar().ToString(); connection.Close(); return succ; }
public List<Priority_info> getPriority_infoByvalidationID(string validationID) { List<Priority_info> list = new List<Priority_info>(); new Priority_info(); SqlConnection connection = new SqlConnection(this.Connect()); SqlCommand command = new SqlCommand("SELECT * FROM priority_info WHERE log_staff='" + validationID + "' ", connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()) { Priority_info item = new Priority_info { xID = reader["xID"].ToString(), countryID = reader["countryID"].ToString(), app_no = reader["app_no"].ToString(), xdate = reader["xdate"].ToString(), log_staff = reader["log_staff"].ToString(), xvisible = reader["xvisible"].ToString() }; list.Add(item); } reader.Close(); return list; }