Posts by Marco Souza • 12,304 points
506 posts
-
3
votes1
answer595
viewsA: Error during DELETE: You can’t specify target table '...' for update in FROM clause
I have read and answered this somewhere, that I know mysql does not accept data change with query in the same table. then try to change your query so that user a variable instead of doing (SELECT…
-
2
votes2
answers63
viewsA: SQL query to identify available hourly providers
Use the operator between if you want to verify an intevalue of a date where hora_entrada between @Data1 and @Data2 Or use the operator AND to check the interval between two fields of your table.…
-
18
votes3
answers314
viewsQ: What is "Idempotency Messages", "idempotentive", "idempotency"?
I have a question on the subject here, and a article on the subject even in Wikipedia, but I still don’t understand the subject, so the questions are, What is Idempotency Messages? How and where it…
-
1
votes2
answers733
viewsA: ASP.NET MVC Entity - Scaffolding for more than one table simultaneously
You would save your data like this; using (var ctx = new stackoverflowEntities()) { var contato = new Contato(); contato.ContatoPricipal = "sei la"; contato.Email = "[email protected]";…
-
1
votes3
answers58
viewsA: Nullreferenceexception error in Join
Change your line to compare pd2 and code codigoDetalhe = pd2 == null && pd2.codigoDetalhe == null ? "000" : "012", A curious thing is that you change the code value. If you’re messing with…
-
0
votes2
answers368
viewsA: C# and Sql Server, inserting with proc using BEGIN TRAN
There is something much easier to retrieve the last inserted record than to create a table after inserting the record in it called SCOPE_IDENTITY() I already answered this here; I got an upgrade on…
-
22
votes3
answers2697
viewsA: What is reactive programming for?
What is reactive programming for? Reactive programming comes to save us in situations where normal flow would be stopped by an error or for a time-consuming response due to the amount of static…
-
1
votes1
answer417
viewsQ: How to pass a list of integers as Dapper parameters?
I am trying to pass a parameter which is a list of integers, this should be attached to query in the sql server IN clause, but I’m not sure how to use it with DAPPER. I tried to do it this way. var…
-
2
votes3
answers1242
viewsA: Update based on a select
You can use a default value if b.value is null or check whether the b.value is null. UPDATE pedidos a SET custo = ( SELECT b.valor FROM produtos_pedidos b WHERE b.id_pedido = a.id and b.valor is not…
mysqlanswered Marco Souza 12,304 -
2
votes1
answer48
viewsA: Update by value difference per id
You have to use a reference from your table when it involves more than one table , that is, use a Join. Try it like this. update CADAS set CADAS.id = novosusuarios.id FROM pen_cadastro as CADAS left…
-
6
votes3
answers1988
viewsA: How many days to a date
Use the DATEDIFF and match your date with the GETDATE() which takes the current date, after that use some logic to send your email. declare @DtInclusao Datetime = '16/07/2017' -- Dias transcorridos…
-
1
votes2
answers20
viewsA: Create COLUNM with results from an account made within a ROW - Mysql
Just do what you have already asked in the question, ie. select (Qtd - QtdEntregue) * ValorUnitário as 'ValorPendente' from MyTabela and if the total value just add. select sum((Qtd - QtdEntregue) *…
mysqlanswered Marco Souza 12,304 -
0
votes1
answer43
viewsA: How can I capture Exception from Circuitbreaker (Polly) and generate a log?
I discovered that the Circuitbreaker does not work by itself, it is necessary to combine it with another policy like Retry. In my case it’s like this. public Task…
-
4
votes1
answer280
viewsQ: Doubt about Design Patterns - Idempotency Messages
I’m trying to create an application example that can call a function/method and that after a certain time it checks if the process has already been executed, if not, call the same function/method…
-
4
votes1
answer471
viewsQ: How does Polly’s Fallback work?
I’m trying to understand how it works Fallback by Polly, but I’m not getting the implementation right. From what I understand he executes another action if the first fails, but that’s not what is…
-
0
votes1
answer43
viewsQ: How can I capture Exception from Circuitbreaker (Polly) and generate a log?
I’m trying to capture through Action onBreak, but apparently it never launches Exception on screen. using Polly; using System; using System.Collections.Generic; namespace CircuitBreakingPolly {…
-
2
votes1
answer38
viewsA: Help with Join in lambda query
Use the left join, it would look like this. listaProfissionalUnidade = (from p in profissionais join u in unidades on p.idUnidade = u.id into u1 from u2 in u1.DefaultIfEmpty() select new…
-
3
votes2
answers150
viewsQ: How do you register all validation classes with Dryioc?
How can I log all my validation classes using Dryioc dynamically ? I’m trying this way down; using DryIoc; using FluentValidation; using System; using System.Linq; using System.Reflection; namespace…
-
12
votes1
answer293
viewsQ: What are the best practices with implementation of Dryioc, Fluentvalidation and Lazy?
I’m building an architecture based on the use of Lazy, DryIoc e o FluentValidation. I intend to do all validations with the object. When actually using the object I will instantiate it (Start). I…
-
5
votes1
answer105
viewsQ: How to use Application Insights in more than one application?
It is possible to use the Application Insights in more than one application and in Azure I have to filter the data of each application separately ?
-
11
votes1
answer1173
viewsQ: What is the difference between WCF and a Web Services?
I’ve always worked with Web Services, but lately I’ve seen a lot if you talk about WCF, hence my doubt. What’s the difference between WCF and a Web Services? Is there some improvement between one…
-
2
votes2
answers766
viewsQ: What is the difference between the versions of Xamarin?
What is the difference between versions Xamarin.Forms, Xamarin.iOS and Xamarin.Android?
-
0
votes1
answer177
viewsQ: How to make a Binding data in a Listview in Xamarin.Android?
I’m trying to do fills a listview with the data from a table, but so far I didn’t understand how to make the Binding date on it. XML; <?xml version="1.0" encoding="utf-8"?> <RelativeLayout…
-
2
votes1
answer176
viewsA: How to get data from Mysql Database?
If that’s what I understand, just increment the fields in the query and text. using (_connection = new MySqlConnection("Database=test;Data Source=localhost;User…
-
1
votes2
answers1113
viewsA: How to return the most appearing words in a column?
I don’t know how this would look in Mysql, I’m without the bank here to do the test, but in sql server would be like this; declare @tabela table ( id int, description varchar(500) ) declare…
-
2
votes1
answer322
viewsA: How to search for tags using Regular Expression?
You can use the expression @"\<([\/?\s?\w]+)\> See the example below. using System; using System.Text.RegularExpressions; public class Program { public static void Main() { foreach (Match…
-
1
votes1
answer113
viewsA: Convert a winform to webform
You’ll need to change (create your application from scratch as a web application) following the rules that apply winForms has. There are some types of web application like ( web Forms, mvc, "web…
-
5
votes3
answers121
viewsA: using of the unnecessary visual studio
Your problem is occurring due to incorrect method creation BindData, at the completion of your method you forgot the (). See the correct statement. public void BindData() { // seu código ... }…
-
2
votes1
answer147
viewsA: Access Restriction, in Design of Visual Studio,com C#!
Your problem is a sql syntax error. Change the line; SqlCommand Comando = new SqlCommand("select * from Restricao where NomeUsuario = '" + usuarioRestricao + "' , SenhadeAcesso = '" + senhaRestricao…
-
0
votes1
answer182
viewsA: Query Linq C#
Try to do the relationships this way. tbUsuario = (from _u in _authEntities.tb_usuario join _gu in _authEntities.tb_grupo_usuario on _u.id_tb_usuario equals _gu.id_tb_usuario into u from usuario in…
-
0
votes2
answers2808
viewsA: Arithmetic overflow error Converting Expression to data type int in Count
Try to use the COUNT_BIG SELECT COUNT_BIG(DML.NK_CO_SEQ_LOTERICA) FROM DW_XCAP.XCAP.DM_LOTERICA AS DML JOIN DW_XCAP.XCAP.DM_PEDIDO AS DMP ON DMP.CO_LOTERICA = DML.CO_LOTERICA JOIN…
-
0
votes3
answers75
viewsA: Doubt with registration grouping
A sub select solves your problem. select * from ( SELECT c.prod_pk_id, '61068276007702' as CNPJ, 'teste' AS FABRICANTE, c.prod_pk_id AS CODIGOPRODUTO, c.prod_nome AS NOMEPRODUTO, case when…
-
3
votes1
answer46
viewsA: QUERY - Can anyone help me mount this query?
Do; SELECT p.descr,p.dt_hr , u1.name, u1.img FROM friends f JOIN users u ON u.id = f.id_user JOIN posts p ON p.id_user = f.id_friend join users u1 on u1.id = f.id_friend WHERE u.id = 1 ORDER BY…
-
5
votes1
answer172
viewsA: Check string Regex C#
I would use C# itself to do this with the Split method; using System; public class Program { public static void Main() { string teste = "X-X-X-XX-XXX"; string[] grupos = teste.Split('-');…
-
2
votes2
answers2268
viewsQ: What is the difference between Tolistasync() and Tolist()?
What difference between ToListAsync() and ToList()? As in the example below, what is the difference between one and the other? using Modelo.Classes.Contexto; using System.Data.Entity; using…
-
1
votes2
answers82
viewsA: Join bringing wrong value
There are two points you need to look at. Your relationship between the tables ON p.id_honorario = h.id_honorario, leave the filter to the clausular and p.tp_honorario = 'Mensal' , something else…
-
8
votes3
answers1381
viewsQ: What is the difference between Data Annotations and Fluent API?
What is the difference between Data Annotations and Fluent API? Is there a restriction between one or the other? Improve performance or are just two ways to do the same thing?
-
2
votes3
answers312
viewsA: Transform a string into multiple substrings whose contents are between apostrophes
The answer above has what you need, I implemented here a little different. using System; public class Program { public static void Main() { string linha = "'Coluna 1' 'Coluna 2' 'Coluna 3'"; linha =…
-
4
votes1
answer39
viewsQ: How to set default properties for variables that start with specific text?
Is there any way to define the properties of a variable as default by the initials of the variables? Something like public string obsUsuario { get; set; }, all of which start with Obs by default the…
-
1
votes1
answer688
viewsQ: How to set a string-like field to nullable in Code First?
I got the field descrPapel of the kind string and would like that field to be created as nullable, that is, to accept null when I was gonna do some Insert/update in records of this type of entity.…
-
3
votes1
answer132
viewsQ: How to simplify declaration of types with Entity Frameowrk?
I have some tables with several fields of type datetime, and for all of them I need to create a validation in Onmodelcreating() for this type, IE, I need to define .HasColumnType("datetime");, my…
-
4
votes2
answers3123
viewsA: Error saving Datetime type field
I managed to resolve declaring the type in Onmodelcreating(); This causes the table not to create the row; ALTER TABLE [dbo].[Usuarios] ADD DEFAULT ('1900-01-01T00:00:00.000') FOR [dtAdmissao] GO…
-
4
votes2
answers3123
viewsQ: Error saving Datetime type field
I am mounting an example of Code First, but when saving a field of type Datetime in the database returns me the following error Conversion of a datetime2 data type into a datetime data type resulted…
-
2
votes2
answers142
viewsA: how to query data in a table that is not related to the other table?
You can use the clauses BETWEEN and EXISTS to check if in the leasing table there are data with what you need. SELECT c.nome, count(c.id) AS disponiveis FROM categoria AS c INNER JOIN veiculo AS v…
-
3
votes2
answers468
viewsQ: What is the corresponding timestamp variable type (SQL Server) in C#?
I have a field in the database (Seqalteracao) of type timestamp and need to map it to C# (Entity Framework). What is the corresponding type in C# for this type in the bank? public **Tipo**…
-
3
votes2
answers140
viewsA: Problem with IN condition in sub-select
If I understand correctly, your Subselect is making a RA_CC IN (sd3.D3_CC)), this will be checked ONE to ONE for each value of your external query, ie for each line that your select do it will check…
-
3
votes2
answers1969
viewsA: How to get the Primary key Identity of an inserted record?
There are some ways to get the ID of your last insert, like the @@IDENTITY, SCOPE_IDENTITY(), IDENT_CURRENT('nome da tabela aqui')OUTPUT e o SELECT MAX. In your case the use of @@IDENTITY or…
-
1
votes2
answers100
viewsA: SQL query for Linq mvc4 c#
Without the model to do a test get a little difficult, but see how it would work group by and the having in the Ligurian. Practically the having becomes a where after the group by. var listaDb =…
-
1
votes1
answer3603
viewsA: How to connect Mysql in Visual Studio 2015?
You need to install the Mysql database provider. Here is the link to install. No login required, just click on the link as shown below, after downloading, follow the installer’s steps. After the…
-
1
votes2
answers739
viewsA: Input string was not in an incorrect format
Your mistake is because you are trying to convert a nonexistent value to type INT, with this you get the error; Run-time exception (line XXX): Input string was not in a correct format. Stack Trace:…
c#answered Marco Souza 12,304