Posts by Marco Souza • 12,304 points
506 posts
-
3
votes5
answers833
viewsA: How to calculate the date and shift code?
See if that’s what you need.. declare @horas table ( serie int, hora datetime ) insert into @horas values (743,'2016-06-24 23:06:19.663'), (744,'2016-06-25 00:05:17.852'), (745,'2016-06-25…
-
2
votes2
answers1332
viewsA: Relationship one for many and many for an Entity Framework
You can use the Entityconfig to make this mapping in an elegant and practical way. It is important to use the Virtual in your relationships, this allows the Entity Framework to create a proxy around…
-
2
votes1
answer669
viewsA: Save to txt file and recover in a combobox
You can read the file every time you make a change to it and upload your combobox with the data you have in it. string[] lineOfContents =…
-
0
votes1
answer40
viewsA: Ignore a certain value with AVG
Seeing your select I believe a group by is missing ... To make the filter you can use the clause having Select user_id, COUNT(*) as total, AVG(`exec_time`) as tempoMedio, SUM(CASE WHEN `success` = 1…
-
1
votes2
answers711
viewsA: INNER JOIN + LEFT JOIN
I believe this is the lack of creating the alias for your TAFGRPROD table, or rather specify it next to the from. SELECT TAFCBHISTPED.NUPED, TAFCBHISTPED.DTEMIS, TAFGRPROD.CDGRPR as…
-
1
votes3
answers113
viewsA: Sum between Mysql lines
You can use a case, if your intention and subtract the amount between types, there is no way you do for all fields as you used in your script select * sum( select * , case whan tipoMovimentacao = 0…
mysqlanswered Marco Souza 12,304 -
2
votes2
answers1290
viewsA: How to check Null in a select @Local_variable
SQL SERVER has the function ISNULL and function COALESCE which makes your code much more elegant and clean. That would be your code. declare @CLIENTES table ( id int, Nome varchar(100) ) INSERT INTO…
-
3
votes2
answers1345
viewsA: Change Boolean column to integer
You can create a Type and use in your table as follows. CREATE TYPE StatusAceitacao AS ENUM ('Aceita', 'Finalizada', 'Fechada'); ALTER TABLE OS ALTER COLUMN STATUS DROP DEFAULT; ALTER TABLE OS ALTER…
-
0
votes2
answers116
viewsA: Difficulty returning the result in a single query without duplicating
you can remove these columns from group by and use the Max(sweat column) or Min(your spine). Something like that. select DISTINCT `clientes`.`id`, `clientes`.`pessoa_tipo`, `clientes`.`razao_nome`,…
-
2
votes1
answer56
viewsA: Service stopped working when generating the chart
amend your Wait as follows. var client = new HttpClient(); string url = $"http://www.inetglobal.com.br/autorizador/api/getliberaitens/{id}"; var response = client.GetStringAsync(url);…
-
0
votes2
answers243
viewsA: Grouping query by date
Try group by with a date formatted with dd/mm/yyyy public void BuscarVendaDeProdurtos_Saidas() { var data1 = Convert.ToDateTime(dateINI_Saida.Text); var data2 =…
c#answered Marco Souza 12,304 -
2
votes1
answer67
viewsA: Place the value of an hql on a var
Try changing your method to; public Compra ConsultaValor() { return Session.Query<Compra>() .OrderByDescending(x => x.DtCompra) .FirstOrDefault(); } And on the call var utimaCompra =…
-
0
votes3
answers3959
viewsA: INSERT INTO NOT EXISTS
You can use the LOWER to make the value of its field identical. INSERT INTO `pagina_extra` (`ID_PExtra`, `ordem_paginas`, `id_menu`, `url_seo`, `url`, `nome`, `titulo`, `conteudo`, `exibir`,…
-
0
votes2
answers67
viewsA: How to avoid the sum of items in my lambda. Result is not expected
As explained in the comments, just include in group by and use Key in select, would look something like this. .GroupBy(gb => new { gb.t1.IdOrcamento, gb.t1.TotalLiquido }) .Select(item => new…
-
2
votes2
answers2954
viewsA: Search XML field information in SQL
You’d have to do something like DECLARE @document varchar(max); SELECT @document =…
-
3
votes5
answers972
viewsA: How to get the name of the day of the week on the first day of the month?
You can mount the query as follows. SELECT (DATENAME(dw, CAST('12' AS VARCHAR) + '/' + CAST('1' AS VARCHAR) + '/' + CAST(DATEPART(yy, getdate()) AS VARCHAR)) )
-
0
votes0
answers183
viewsQ: How to set value in a Textarea field using webbrowser?
I am trying to set a value in a Textarea type field using webbrowser, but it is not being set the value. I’ve tried it like this; webBrowser.Document.GetElementsByTagName("p")[2].InnerHtml = texto;…
-
4
votes2
answers230
viewsA: Sub-consultations with SELECT declaration in Sqlite
The point is that you are creating a select based on variables created in FROM when it should be direct in the SELECT. Change your query to. SELECT (select sum(VALOR) form LANCAMENTO where…
sqlite3answered Marco Souza 12,304 -
0
votes1
answer148
viewsA: How to flirt a checkbox via webbrowser?
As requested the solution was thus. if (curElement.GetAttribute("className").ToString() == "checkbox") { foreach (var item in curElement.All) { if (((HtmlElement)item).InnerText == null) continue;…
-
1
votes1
answer148
viewsQ: How to flirt a checkbox via webbrowser?
I’m trying to book a checkbox via webbrowser, but I’m not getting through. HtmlElementCollection theElementCollection = default(HtmlElementCollection); theElementCollection =…
-
0
votes2
answers978
viewsQ: How do I click the java script Alert ok via Webbrowser?
How can I disable all javascript alerts via web browser ? When I’m loading the page. <link rel="stylesheet" href="css/bootstrap-theme.min.css"> <meta charset="UTF-8"> <!-- Latest…
-
3
votes1
answer142
viewsQ: How to read the value of a readonly field?
I’m trying to read the value of a readonly field, but I’m not able to access its value, it doesn’t have the value in html only appears in the browser. <form id="form1" name="form1">…
-
1
votes1
answer231
viewsQ: How to navigate to another page using Webbrowser?
I am trying to access a URL and send login and password for authentication and then browse between pages? After I log in to the page http://indigo.rafson.com.br, I’m not getting switched to another…
-
1
votes1
answer404
viewsA: How can I validate an Enum using Fluentvalidator?
You’ve come very close to the solution, you can use the Must to check the type of your fields or to field them with other fields or in your case with a enum, To know if a field type is equal to a…
-
0
votes1
answer432
viewsQ: How to map a List to another List?
How can I map a list from one type to another list of another type ? I’m getting an object list of type public List<DetalheViagem> DetalheViagems { get; set; } And I need to move the valuables…
-
1
votes1
answer51
viewsA: Converts an SQL query into Entity Query
Try to do it this way. var query = (from i in dbContext.inscricao join p in dbContext.participante on i.ParticipanteId equals p.ParticipanteId join a in dbContext.Atividade on p.AtividadeId equals…
-
1
votes1
answer34
viewsA: Filtering result by category
There is not much secret, just know which field you will use to filter. Assuming you have an Idcategoria is either filter by Idcategoria = 1 would look like this; var prodtutos = query.Where(p =>…
-
4
votes3
answers111
viewsA: Prevent data from appearing in MYSQL search
If you return the Products = 30 your own query returns it right. Select * From tabela_exemplo where Produto = '030'; Now to filter the Products = 30 and Purchases >= 0, if this is the field of…
-
2
votes2
answers1906
viewsA: Calculate Difference between 2 dates (has time in them)
Your first example would be 1:00. It should appear to me 1:10 am. Try it this way. declare @DataInicial datetime = cast('09/11/2017 11:35' as datetime) declare @Datafinal datetime = cast('09/11/2017…
-
1
votes3
answers1195
viewsA: Convert nvarchar(50) field to SQLSRV table datetime
You need to create a new column to receive your converted data and then delete the old column, after that just rename the new column. An important detail in your select is the filtering of the data,…
-
1
votes2
answers395
viewsA: How to extract the date-time of a given XML field in a string - Query SQL Server 2012
If your string contains only one DATE and that date was inside your <par formatarData=, you can use the CHARINDEX to check the position it is in and get it through the SUBSTRING. declare @texto…
-
20
votes3
answers8582
viewsQ: What are Parallel.For and Parallel.Foreach loops?
I saw the use of Parallel.For and Parallel.ForEach in some places, I know they are loops, but I didn’t understand how and when to use them and I have my doubts. What are loop Parallel.For and…
-
6
votes3
answers172
viewsA: What is the difference in the 3 types of variables and how do they behave in the compiler?
In reality you are creating variables and methods and assigning values to them differently. Like the first. static int valor1 = 10 / 5; Here you declare the variable valor1 as an integer and static…
-
1
votes7
answers412
viewsA: Mount an sql query filtering data
Use not exists to check for Nfs that are more than one status. SELECT id,nf,status,data FROM documentos d1 WHERE status LIKE ('%EXCLUIDO%') and not exists (SELECT 1 FROM documentos d2 where d1.nf =…
sqlanswered Marco Souza 12,304 -
10
votes2
answers1392
viewsQ: What are they, Readpast and Nolock?
What is READPAST and NOLOCK? I’ve seen quite a lot of the use of NOLOCK, but the READPAST I saw the use now, practically the same way, ie. FROM dbo.table t WITH(READPAST) and FROM dbo.table t…
-
22
votes3
answers29017
viewsQ: What is ROW_NUMBER?
What is ROW_NUMBER used in the sql server? How and where we should use it? Has a simple example of use ?
-
11
votes1
answer259
viewsQ: How to remove the last number from an integer?
How can I remove the last number from an integer? Ex: int value = 123456789; int newValue = 12345678; Note that the new value does not have 9. I know it would be possible to switch to a string and…
-
0
votes1
answer503
viewsA: ASP.NET MVC + Entity - How to map new tables
You can open the designer by right-clicking on your file .EDMX and selecting Open With -> ADO.NET Entity Data Model Designer Right click on the designer’s surface .EDMX and click on Update Model…
-
2
votes1
answer1136
viewsQ: How to generate 5 digit number automatically?
How can I generate a random number with 5 digits that do not repeat in the range [10000 - 99999]. I built the solution low and had generate in a loop the times I ran not returned repeated numbers,…
c#asked Marco Souza 12,304 -
1
votes2
answers751
viewsA: Entityframework - new table not created
It is often necessary to delete the files from Migrations and recompile the project and run the Update-Database. Sometimes it is also necessary to use the Update-Database -Force To see what was…
-
2
votes1
answer639
viewsQ: How to pass parameter to a Controller constructor?
How can I inject a parameter into my Controller constructor? I have the CategoriasController with a builder waiting for the IAppServiceCategories appService, When I call a mistake returns to me.…
asp.net-mvcasked Marco Souza 12,304 -
0
votes3
answers83
viewsA: How to make a max + 1 with lambda or Linq, but with tables from nothing, all null
You can use a Default solution for when your table has not had data. public int GeraIdBalanca() { return contexto.Balancas.Select(m => m.IdBalanca).DefaultIfEmpty(0).Max() + 1; }…
c#answered Marco Souza 12,304 -
1
votes1
answer1197
viewsQ: Differences between Commit Staged, Commit Staged and Push, Commit Staged and Sync?
I installed the Gitflow plugin and came across 3 options to commit. Commit Staged. Commit Staged and Push Commit Staged and Sync What’s the difference between them? When should I wear them?…
gitasked Marco Souza 12,304 -
3
votes2
answers343
viewsQ: Many to Many with Fluent API
I’m doing a mapping with Fluent API and I came up with a question on how I should do the mapping very much. For example, I have the classes below. public partial class Territories { public…
-
1
votes2
answers1031
viewsA: Null object on Deserializar Json
I had no problem consuming your JSON. I rode a POC GIT thus. static void Main(string[] args) { { string path = @"C:\work\stackoverflow\stackoverflow\ConsoleApp1\bin\Debug\new 1.txt"; // Open the…
-
2
votes3
answers69
viewsA: I have this cursor and the Where 'between' gives error. I wanted to select the years 2005 to 2008
You have two syntax error that I could see right away, the first is the use of BETWEEN AND year(OrderDate) '2005' between '2008' The correct syntax is WHERE col BETWEEN value1 AND value2 And your…
-
5
votes1
answer204
viewsQ: What is it, Beacon?
What is Beacon? How can I implemented using Android? Can be implemented in . NET or only in java? Have some simple example?
-
7
votes1
answer86
viewsQ: What is a Circuitbreaker?
I’ve seen some definitions about Circuitbreaker, but I still don’t understand how to use it and I have my doubts. What is the best case scenario to be applied? What should be aborted to be fully…
-
1
votes1
answer471
viewsA: How does Polly’s Fallback work?
I was riding the wrong way :( of course, what I really needed was to pass the action to POLLY’s Fallback method without doing anything else, the way it was implemented was not giving error, but it…
-
0
votes2
answers150
viewsA: How do you register all validation classes with Dryioc?
I found a different way to do the dependency injection, was sinning on my foreach. foreach (var implementingClass in implementingClasses) { container.Register(implementingClass, Reuse.Singleton); }…