Posts by Daniel Giacomelli • 307 points
24 posts
-
0
votes2
answers73
viewsA: C# Newtonsoft.Json - Add property during serialization
Solution I was able to find a solution. My problem was in converting the class instance into a JObject before proceeding with serialization. When I did this, the type of class was lost, and so the…
-
-1
votes2
answers73
viewsQ: C# Newtonsoft.Json - Add property during serialization
Hello! I’m trying to customize the serialization of a class using the Newtonsoft.Json. My intention is to add a property in JSON during the serialization of the object. Following the official…
-
1
votes1
answer125
viewsA: Is there any way to select a comparison of duplicate records?
You can do it using the Window Function ROW_NUMBER. In this code, I created a column to make a sort of "sort" of records. When the column rownum is equal to 1, means it is the first single record of…
-
2
votes1
answer71
viewsA: Denied permission when creating folder
You need to access your program as an Administrator (right-click, Run as Administrator), or if you are thrashing have to do the same to open Visual Studio. If you want to ensure that your…
c#answered Daniel Giacomelli 307 -
1
votes2
answers45
viewsA: About Windows.Forms from C#
You need to use the property Text to obtain the value entered in the Textbox. Using the method ToString(), unless it has been implemented differently in the object, you will always get the full name…
c#answered Daniel Giacomelli 307 -
1
votes1
answer63
viewsA: Telerik Radgrid loses paging when exporting to Excel
Your Javascript function preventTableBreakPager does not need to be called in the button click, because the Grid does not need to be updated. I had the same problem with exporting Telerik to Excel…
-
0
votes1
answer54
viewsA: Update json object in a varchar column
In the latest versions of Postgres, there are several functions for handling JSON. But considering you need to use the type VARCHAR and update only a portion of JSON in the column, I suggest using…
-
0
votes2
answers322
viewsA: Insert a Count(*) value into a variable in Postgresql
Considering you’re a Rigger BEFORE, I think your code should look something like this: CREATE OR REPLACE FUNCTION verificaReservaQuarto() RETURNS SETOF TRIGGER AS $$ DECLARE ocupado BOOLEAN;…
-
0
votes2
answers196
viewsA: Error Searching for Serial Postgresql
The function CURRVAL returns the last value of the sequence generated in your session. This error occurs when calling the function CURRVALS without first having advanced to SEQUENCE. In your case,…
-
0
votes1
answer33
viewsA: How to make Telerik Radhtmlchart responsive?
You need to use the functions set_width and set_height to resize the chart. You just need to calculate the proper dimensions to fill the entire screen. function adjustChartSize(chartClientId, width,…
-
1
votes2
answers120
viewsA: What is the correct place to store the validation messages in a . NET project?
I have done all the domain validation through Exceptions with specific types for each Entity (or Aggregate Root if we are talking about DDD). This makes it even easier to implement translations into…
-
1
votes2
answers522
viewsA: Current value of an "auto increment" field in Postgresql
The field type "Auto Increment" of Postgres is called SERIAL field INT and BIGSERIAL field BIGINT. The command to create this column type is: ALTER TABLE tabela ADD coluna SERIAL NOT NULL; When…
postgresqlanswered Daniel Giacomelli 307 -
1
votes3
answers101
viewsA: Return value corresponding to date
Try this way. Just replace the date 2019-11-19 by the date you want to search. SELECT custo_saida FROM tabela WHERE (data_saida = '2019-11-19' OR data_saida IS NULL) ORDER BY data_saida DESC NULLS…
-
1
votes1
answer403
viewsA: I want to compare in Mysql "IF" or "CASE"
You forgot to put the second THEN, and jumped right into the ELSE: SELECT (CASE WHEN '2019/12/05 00:00:00' >= age_start THEN 'existe' WHEN '2019/12/05 00:00:00'<= age_end THEN 'Menor igual a…
mysqlanswered Daniel Giacomelli 307 -
0
votes2
answers53
viewsA: Aggregation error only in postgresql 9.4
Strange this error, the SQL command seems correct. Try to put the Sub Select in a WITH: WITH query_estoques AS ( SELECT setores.nome setor_nome, estoques.setor_id setor_id, estoques.material_id,…
-
3
votes1
answer231
viewsA: Merge 3 selects into a single select
Have you tried using WITH QUERIES to unite this data? Would look like this: WITH query1 AS ( select WAREHOUSE_ID, WAREHOUSE_NAME, TOTAL_ELAPSED_TIME, QUERY_TEXT, START_TIME from…
sqlanswered Daniel Giacomelli 307 -
0
votes2
answers420
viewsA: C# Web Forms - Missing Session
There may be several reasons why the session is being lost. It is usually linked to the App Pool or the IIS itself to be restarted. This may occur for any of the following reasons:: When the…
-
0
votes1
answer82
viewsA: select return results without repeating reply
Try to make use WITH QUERIES to process the data until you get the result you need. Try using this SQL command and then tell us if it worked. WITH -- Lista os Totais por UF query_totais AS ( SELECT…
-
2
votes1
answer68
viewsA: A Rest API is a combination of . EXE and . DLL’s?
Rest Apis are services consumed through the Http protocol. The consumption of these Apis is done by a client, which can be a Javascript code, an executable, a Dll... any program that can make an…
-
0
votes2
answers301
viewsA: Validation of regex URL
Try using that expression: ^(?:https?:\/\/)?(w{3}\.)?[\w_-]+((\.\w{2,}){1,2})(\/([\w\._-]+\/?)*(\?[\w_-]+=[^\?\/&]*(\&[\w_-]+=[^\?\/&]*)*)?)?$ You can test on the link:…
-
0
votes2
answers121
viewsA: Select higher value between Mysql Joins
I think a ORDER BY DESC in the field data_cadastro, followed by a LIMIT 1 solves your problem: SELECT * FROM cursos_aulas LEFT JOIN cursos_aulas_arquivos ON cursos_aulas_arquivos.cursos_aulas_id_fk…
-
0
votes2
answers103
viewsA: sql Where with max(timestamp)
The most effective way to get the id of the latest match is this: select partida_id from partida order by 'data' desc limit 1
mysqlanswered Daniel Giacomelli 307 -
1
votes1
answer76
viewsA: SQL - Perform the removal of two rows in separate tables connected with Foreign Key
The only way to avoid the error of violation of Foreign Key is undoing the link between the records. There are only two ways to do: First deleting child records: DELETE FROM itens_pedido WHERE…
-
3
votes1
answer625
viewsA: How to use CASE in a Where clause
I would make that condition using OR instead of CASE WHEN. Would look like this: SELECT * FROM Formulario WHERE DataInclusao = '2019-10-28 08:19:54.000' AND chave = 'XXXXXXX' AND Id = 2 AND…