public int GetIDWaluty(string Data) { string value = string.Empty; String sql = $"SELECT IDWaluty FROM Waluta WHERE NazwaW='{Data}'"; using (SqlConnection con = new SqlConnection(GetConnectionString.ConString())) { con.ConnectionString = "Data Source=LAPTOP-ASA6V7LH\\SQLEXPRESS;Initial Catalog=BDW;Integrated Security=True"; SqlCommand cmd = new SqlCommand(sql, con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { var view = new ZbierzDaneZBazy(); value = rdr["IDWaluty"].ToString(); } } return(Int32.Parse(value)); }
public List <ZbierzDaneZBazy> GetNominal() { String sql = "SELECT * FROM Nominal"; var model = new List <ZbierzDaneZBazy>(); using (SqlConnection con = new SqlConnection(GetConnectionString.ConString())) { con.ConnectionString = "Data Source=LAPTOP-ASA6V7LH\\SQLEXPRESS;Initial Catalog=BDW;Integrated Security=True"; SqlCommand cmd = new SqlCommand(sql, con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { var view = new ZbierzDaneZBazy(); view.NazwaN = rdr["NazwaN"].ToString(); model.Add(view); } } return(model); }