Posts by João Martins • 5,597 points
279 posts
-
1
votes1
answer279
viewsA: Bold highlight a concatenated item
I don’t think you’ll be able to put details of a RichText in the DisplayAlert shaman. In the Soen there is one question, very similar, but it referred to italics, and the answer was to create a…
-
1
votes1
answer401
viewsA: Left Outer Join Pulling Only Contained Data
Following the user’s instructions bfavaretto, besides some Refactoring and optimization: SELECT XC.crs , XM.nome , XV.visitador , XF.familia , IFNULL(XG.nome, '') AS NomeGestante FROM X_Familia XF…
-
2
votes3
answers58
viewsA: Field referring to the MAX
Another way of doing: SELECT P1.VEICULO , P1.REVISAO , P2.DATAINCLUSAO FROM PLANOS P1 INNER JOIN ( SELECT MAX(DATAINCLUSAO) AS DATAINCLUSAO , VEICULO FROM PLANOS GROUP BY VEICULO ) P2 ON P2.VEICULO…
sqlanswered João Martins 5,597 -
2
votes1
answer28
viewsA: Mysql and PHP Comparison SUBQUERY
I think the problem is in the "." points of yours query. Try changing your variable $sql as follows: $sql = "SELECT r.* FROM `registros` r WHERE r.`registro` = 'A' ". $where_clause ." ORDER BY…
-
1
votes1
answer299
viewsA: Problems using INSERT in PHP (mysqli)
After creating the Prepared Statement need to do the bind of values: $stmt->bind_param("ss", $login, $senha); Otherwise nothing is executed: <?php $conn = new mysqli("zz", "zz", "zz", "zz");…
-
0
votes1
answer693
viewsA: Function to return months of year sql server
Try doing it this way: CREATE FUNCTION fn_TotalMesAno(@Data DATE, @Ano INT, @Cnpj NVARCHAR(20)) RETURNS INT AS BEGIN DECLARE @Contador INT IF ISNULL(@Ano, 0) = 1 SELECT @Contador = COUNT(1) FROM…
-
0
votes2
answers55
viewsA: Doubt with group by - sql
I think this query solves your problem: SELECT d.nome_departamento , p2.descricao , p.valor FROM departamento d INNER JOIN ( SELECT MAX(valor) AS valor , MAX(id_produto) AS id_produto ,…
-
2
votes1
answer604
viewsA: SQL recursive using CTE
In the use of CTE needs to have certain care, especially in the possibility of entering loop infinite. You can set the maximum recursion of a CTE using the following command: -- definir o limite de…
-
5
votes1
answer50
viewsA: How do I order a Complex List?
I think you want it something like this: List<Tipo> ListaTipo = new List<Tipo>(); ListaTipo.Add(new Tipo() { NomeSubTipo = new List<SubTipo>() { new SubTipo() { NomeSubTipo = "B"…
-
0
votes2
answers1189
viewsA: Join several PDF files into one
What is missing from your code is to get the multiple files selected in FileUpload. The estate AllowMultiple="true" is well awarded but is not taking advantage of it. The goal is to use only one…
-
0
votes1
answer204
viewsA: Inclusion of files in Visual Studio projects
Try doing it this way: var p = new Microsoft.Build.Evaluation.Project(@"C:\MyFolder\MyProject.csproj"); string strNewItem = @"C:\MyImages\IMG_20180926-WA0017.jpg"; if (p.Items.FirstOrDefault(x =>…
-
3
votes1
answer35
viewsA: Error in SQL query
I think there’s some confusion in your query. This ultimo is there too much, as well as the 2nd FROM. Try it this way: SELECT ( SELECT localizacao.horario AS proximo FROM localizacao WHERE…
-
2
votes1
answer101
viewsA: How to open new window only if it is not already open?
Taking advantage of the recommendation of the colleague Tuxpilgrim, see if the following code helps you: Dim newWindow As Window1 newWindow = Application.OpenForms().OfType(Of…
-
0
votes1
answer40
viewsA: Database First approach with Lazy Loading disabled?
The simplest way is to directly disable the Lazy Loading: static void Main(string[] args) { clienteCTX context = new clienteCTX() { Configuration.LazyLoadingEnabled = false }; var _model =…
-
0
votes1
answer290
viewsA: How to read XML in Vb.net?
Your XML should be something like this: <Grupos> <Grupo pasta="C:\...\Arquivos\Videos"> <Videos> <Video>C:\...\Arquivo 1</Video> <Video>C:\...\Arquivo…
-
0
votes2
answers289
viewsA: Add a column with data in Varchar2 format
Considering you need to add a column that’s kind of VARCHAR, need to convert the column to this. Then, in the GROUP BY need to put all other columns that are not being summed. In your case it would…
-
1
votes2
answers76
viewsA: SQL SERVER Counting the data of a record
I think this way you get what you want: SELECT iConvenio , COUNT(1) AS resposta INTO #tmpSim FROM tabela WHERE EnderecoSi = 1 OR EnderecoSit = 1 OR EnderecoContr = 1 -- OR ... GROUP BY iConvenio…
-
1
votes1
answer290
viewsA: SQL Query to Group Records in MS-ACCESS
I think this syntax is accepted in MS-ACCESS: SELECT Estado , SUM(IIF(Genero = 'F', 1, 0)) AS FEMININO , SUM(IIF(Genero = 'M', 1, 0)) AS MASCULINO FROM tbList GROUP BY Estado I assumed in the column…
-
1
votes1
answer111
viewsA: relate two tables
This way you must get what you want: -- Descomentar apenas se a solução abaixo não resolver o problema -- EXEC sp_configure 'show advanced options', 1 -- GO -- RECONFIGURE -- GO -- EXEC sp_configure…
-
1
votes2
answers44
viewsA: Doubt in Postgresql function
Experiment as follows: CREATE OR REPLACE FUNCTION verificarDb(tb regclass, OUT result boolean) AS $$ BEGIN EXECUTE format('SELECT EXISTS ( SELECT 1 FROM pg_class c WHERE relname = ''%s'' AND…
-
2
votes1
answer61
viewsA: Download file with mvc is giving dick
The problem is that you are almost certainly using the class System.IO.File, which is static, so cannot be instantiated or returned. Try changing the line return File(fileBytes,…
-
1
votes2
answers83
viewsA: Insert comma after checking more than one name
Just make a string.Join: foreach (var user in users) user.TypesModelAggregate = string.Join(",", user.typesModel.Name); This way the concatenation is made by each element.…
-
0
votes2
answers48
viewsA: Apply condition depending on value
Will you get the results you want? SELECT DISTINCT SB2.B2_FILIAL , SB2.B2_COD , B1_DESC , SB1.B1_TIPO , SB2.B2_LOCAL , CASE WHEN SD3.D3_UM = ' ' THEN SB1.B1_UM ELSE D3_UM END D3_UM , ( SELECT…
-
0
votes1
answer88
viewsA: How do I use threads or something in that code?
Try it this way: Private Sub ColocarPastasDestroDoListView(ByVal Caminho As String, gp As ListViewGroup) Dim caminho_saida As String = "C:\Users\...\source\repos\ApenasPronto\ApenasPronto\Thumb\"…
-
0
votes2
answers1138
viewsA: SQL Syntax Error Exception: ORA-00928: SELECT keyword not found
I think in your case the solution is simple: CREATE OR REPLACE PROCEDURE SP_INSERIRCLIENTE ( CPF IN INTEGER , NOME IN VARCHAR2 , EMAIL IN VARCHAR2 ) IS BEGIN INSERT INTO CLIENTE VALUES(CPF, NOME,…
-
0
votes1
answer84
viewsA: Error - string C# for Crystal Report
I think you can replace all this one-parameter assignment code with this: cryRpt.SetParameterValue("usuario", "Eu!"); After this substitution may even fail to give you error, if the parameter…
-
8
votes1
answer3138
viewsA: Why when using ON DUPLICATE KEY UPDATE or REPLACE, do we have change in 2 lines?
According to the information in the manual relating to ON DUPLICATE KEY UPDATE: INSERT ... ON DUPLICATE KEY UPDATE Syntax With the ON DUPLICATE KEY UPDATE, the mysql_affected_rows() is 1 if the line…
-
0
votes1
answer97
viewsA: Insert Dataset data into database
If you already have all the information stored on DataTable then the need will be to enter it in the database: private void InsertData(dynamic fbCon, string table, List<(string Field, dynamic…
c#answered João Martins 5,597 -
1
votes2
answers59
viewsA: Problem running SQL
If the column Campo always the same format (alphanumeric characters + later numeric characters) so you can do it as follows: SELECT Campo FROM Tabela ORDER BY CAST(SUBSTRING(Campo, 4, LEN(Campo)) AS…
sqlanswered João Martins 5,597 -
2
votes1
answer712
viewsA: How to resolve reference error in Visual Studio Community 2017?
In the Visual Studio 2017 the way to resolve references is through the option Quick Actions and Refactorings..., which is the same as accessing the shortcut Ctrl + .. You can also access the small…
-
1
votes1
answer94
viewsA: String in expression Entity C#
In your class DbContext create a method, for example, Set, that returns a DbSet from the name passed in parameter (from your table): public DbSet Set(string name) { // talvez seja necessário…
-
2
votes1
answer99
viewsA: SQL query inside java
To do this, you will need to effectively use the LIKE with the wildcard %. If you are using a PreparedStatement, which is what it looks like, you’ll have to put the wildcard the value you want to…
-
1
votes1
answer43
viewsA: Error when modifying a View column with calculation
Try it this way: ALTER VIEW ConsolidadoBaseSifis AS WITH contabilidade AS ( SELECT iUnidade , COUNT(iUnidade) AS iQuantidade , COUNT(vSimNao) AS iSimNaoRespondido , COUNT(vResp) AS…
-
0
votes2
answers60
viewsA: Data search without formatting sqlserver with select
You can do it in a more "like" way RegEx: DECLARE @Input VARCHAR(100) = 'abc1234-6a,9*isd(yt«?56AYZ' WHILE PATINDEX('%[^a-z]%', @Input) > 0 SET @Input = STUFF(@Input, PATINDEX('%[^a-z]%',…
-
2
votes2
answers814
viewsA: Delete triggers by query
A more "simple" way of doing it will be like this: DECLARE @SQL AS NVARCHAR(MAX) = '' SELECT @SQL = @SQL + 'DROP TRIGGER ' + [name] FROM sys.triggers WHERE [name] LIKE 'COP%' EXEC(@SQL)…
-
5
votes1
answer782
viewsA: How to create Trigger for all tables in a bank automatically?
I believe that in this way you will be able to achieve what you want: CREATE TABLE [log] ( Id UNIQUEIDENTIFIER CONSTRAINT log_Id_DF DEFAULT(NEWID()) NOT NULL , [Timestamp] DATETIME CONSTRAINT…
-
0
votes1
answer200
viewsA: How to split the screen with 2 Open Forms within an MDI
Try evoking the following method: this.LayoutMdi(System.Windows.Forms.MdiLayout.TileVertical); Will make all the MdiChild organize themselves vertically.…
-
0
votes1
answer32
viewsA: How to add a certain value to an Integer of a JSON in Vb.net?
Try doing it this way: Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Dim channel As JObject = JObject.Parse(File.ReadAllText("C:\stats.json")) With channel…
-
1
votes1
answer63
viewsA: Doubt with foreach C#
I think the code below solves your problem with fewer lines, provided that the association between the letters is always the one you indicated in your question: string frase0 = string.Empty; char[]…
c#answered João Martins 5,597 -
2
votes1
answer67
viewsA: Print whenever variable receives a certain value
Do not need the variable x, just need to validate whether the rest of the entire division by 10 is 0: void OnBecameInvisible() { Score.score += 1; if ((Score.score % 10) == 0) Debug.Log("VALOR DE…
-
0
votes1
answer95
viewsA: How to fix image with "low quality" in Listview
Try creating the image with the original color management: Dim imagem As Image = Image.FromFile(strImagem, True) If it still doesn’t look like you want, implement the following method: Private…
vb.netanswered João Martins 5,597 -
0
votes1
answer44
viewsA: Rankin in in Mysql
SELECT RH.NOME_FUNCIONARIO , SUM(CASE WHEN RFA.CPF IS NOT NULL THEN 1 ELSE 0 END) AS Total FROM RH LEFT JOIN registro_faltas_atraso RFA ON RFA.CPF = RH.cpf WHERE RH.TIPO_CONTRATO…
-
3
votes1
answer123
viewsQ: Manage Datatable with lots of information
I have here a "small" problem with a DataTable. From an SQL query I am getting a huge amount of records (> 1,000,000), and although the consultation is relatively quick, the loading of the…
-
0
votes2
answers52
viewsA: Compare and print comma separated data
The problem is the way you’re reading the information. I think you’ll get there: if (dia == "" || mes == "" || ano == "") { ERRO erro = new ERRO(); erro.Show(); } else { using(StreamReader…
-
0
votes2
answers76
viewsA: Post-comma replacement in C#
In a simple way you can do this with a Split: string[] split = textBox1.Text.Split(','); split[2] = "Poção Vermelha"; textBox2.Text = string.Join(",", split);…
c#answered João Martins 5,597 -
0
votes3
answers89
viewsA: problem with select case
All you have to do is increase the output of both columns: SELECT SUM(CASE WHEN cor.status = 35 THEN 1 ELSE 0 END) AS finalizadas , SUM(CASE WHEN cor.status = 50 THEN 1 ELSE 0 END) AS…
-
1
votes1
answer517
viewsA: If chained - how to eliminate?
I didn’t quite understand the point of the method Codigo class Negocio, but I imagine that the one that wants to return a first value that is not null or empty. If so, the following code can help…
-
0
votes1
answer69
viewsA: Submit ITEXTSHARP Report in a Form
I think the only way would be to use the component COM of Acrobat Reader (of course, requires the application to be installed): Right click on your ToolBox and select "Choose items" (Select Items)…
-
0
votes1
answer40
viewsA: Doubt generating entity from Cs file code in edmx C#
That method, AddObject and DeleteObject, are used in older versions of EPH and belong to the ObjectContext, but at EF6, for example, we work with a DbContext, which has a different way of managing…
-
6
votes3
answers440
viewsA: Get the elements around a selected in the matrix
The problem is that some indices are exceeding the limits of Array, either more (more than the maximum index) or less (-1). The solution will be to validate everything before assigning the value to…