コード例 #1
0
        public int SaveDetails()
        {
            SqlConnection con = new SqlConnection(GetConnectionString.ConString());

            con.ConnectionString = "Data Source=LAPTOP-ASA6V7LH\\SQLEXPRESS;Initial Catalog=BDW;Integrated Security=True";
            string query = "INSERT INTO Zestawienie(NazwaZ,IDFirmy,IDWaluty,il_N1, il_N2, il_N3,il_N4,il_N5,il_N6,il_N7,il_N8,il_N9,il_N10,il_N11,il_N12,il_N13,il_N14,il_N15) values ('" + NazwaZ + "','" + IDFirmy + "','" + IDWaluty + "'" +
                           ",'" + il_N1 + "','" + il_N2 + "','" + il_N3 + "','" + il_N4 + "','" + il_N5 + "','" + il_N6 + "','" + il_N7 + "','" + il_N8 + "','" + il_N9 + "','" + il_N10 + "','" + il_N11 + "','" + il_N12 + "','" + il_N13 + "','" + il_N14 + "','" + il_N15 + "')";
            SqlCommand cmd = new SqlCommand(query, con);

            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            return(i);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public int SaveDetails(string nazwa, string adres, string miasto, string kod, string bank, string konto)
 {
     if (nazwa != null && adres != null && miasto != null && kod != null && bank != null && konto != null)
     {
         SqlConnection con = new SqlConnection(GetConnectionString.ConString());
         con.ConnectionString = "Data Source=LAPTOP-ASA6V7LH\\SQLEXPRESS;Initial Catalog=BDW;Integrated Security=True";
         string query = "INSERT INTO Firma(Nazwa, Adres, Miasto, Kod, Bank ,Konto) values ('" + nazwa + "','" + adres + "'," +
                        "'" + miasto + "','" + kod + "','" + bank + "','" + konto + "')";
         SqlCommand cmd = new SqlCommand(query, con);
         con.Open();
         int i = cmd.ExecuteNonQuery();
         con.Close();
         return(i);
     }
     else
     {
         return(0);
     }
 }
コード例 #4
0
        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);
        }