コード例 #1
0
        public string Put(Fleteras fleteras)
        {
            try
            {
                DataTable table = new DataTable();

                string query = @"update Fleteras set Nombre = '" + fleteras.Nombre + "',Direccion = '" + fleteras.Direccion + "' where idfletera=" + fleteras.IdFletera + "";


                using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }



                return("Se Actualizo Correctamente");
            }
            catch (Exception exe)
            {
                return("Se produjo un error" + exe);
            }
        }
コード例 #2
0
        public string Post(Fleteras fleteras)
        {
            try
            {
                DataTable table = new DataTable();
                string    query = @"
                                 insert into Fleteras values ('" + fleteras.Nombre + "' , '" + fleteras.Direccion + "')";

                using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }



                return("Fletera Agregada");
            }
            catch (Exception exe)
            {
                return("Se produjo un error" + exe);
            }
        }