Posts by Marco Souza • 12,304 points
506 posts
-
1
votes3
answers192
viewsA: Formatting with UNION and LINQ in C#
I’d do it this way.. protected void Page_Load(object sender, EventArgs e) { using (var Db = new WdbContext()) { GridView1.DataSource = Db.pessoa .Vw_PessoaTipos(Db) .ToList(); GridView1.DataBind();…
-
0
votes3
answers944
viewsA: Return the Id of table 1 and insert in table 2 in the same code
You can do it this way declare @Grupo1 table ( Grupo1Id int IDENTITY(1,1) NOT NULL, nome varchar(100), idade int, telefone varchar(15) ) declare @Grupo2 table ( Grupo2Id int IDENTITY(1,1) NOT NULL,…
-
0
votes1
answer99
viewsA: Collection of objects c#
See the example below; This is an application webforms, but you only need to understand the class part and what you have within the method Page_Load. using System; using System.Collections.Generic;…
-
4
votes2
answers737
viewsA: Concatenate fields in a more performative way
Another way would be to use the STUFF it is 4 times faster than using COALESCE, I do not know other ways to do it more performatively than these two. SELECT * INTO #T FROM ( SELECT 2 TIPO, 17…
-
1
votes2
answers2315
viewsA: Numeric Overflow with Numeric(18,7) in Firebird
In Firebird literals with a dot decimal are of the type NUMERIC , nay DOUBLE PRECISION (or another type of floating point). This means that it will apply its exact numerical calculation rules. Thus,…
-
2
votes3
answers2863
viewsA: Copy data from one table to another without entering field by field
You can do it 3 ways. -- sql tabela volátil só existira em tempo de execução declare @HIERARQUIA table ( [ID_HIERARQUIA] [int] NOT NULL, [MICRO] [int] NOT NULL, [DESCR] [varchar](250) NOT NULL,…
-
0
votes1
answer809
viewsA: Tree View hierarchical Dynamic C#
It’ll cost a bill... <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExemploTreeView.aspx.cs" Inherits="WebApplication1tiraduvidas.ExemploTreeView" %> <!DOCTYPE html PUBLIC…
-
1
votes1
answer55
viewsA: Mysql - No changes Detected
Mysql displays this message MySql - No changes detected, one sees that the script has already been executed or nothing has been changed in Script. What may have happened is you have clicked on Apply…
mysqlanswered Marco Souza 12,304 -
1
votes1
answer81
viewsQ: How to set Title in a`img`?
Is there any way to set the title (Text) of the component img in the code behind? <tr> <td colspan="7"> <img id="ProximoMes" src="../Images/Icons/dright.gif" /> </td>…
-
0
votes1
answer78
viewsA: Link click function is not called
See if it works. $('#remove_input').click(function() { var count_field = $('#count_field').val(); var parent_class = $(this).parents('tr'); if (parent_class.hasClass('pending')) {…
-
1
votes1
answer105
viewsA: Result update from another table
See if that’s what I understand... update pq set quantidade_estoque = 0 from produto_estoque pq join ( SELECT id_grade,max(data_lancamento) FROM faturamento_produtos where data_lancamento <…
-
3
votes4
answers3541
viewsA: How to bring records of a LEFT JOIN even if not obeying the WHERE?
Practically you just need to remove the Where, because it makes the final filter, that is, only the lines that have the filter Where will resume , if you use the AND shortly after the ON of LEFT…
-
1
votes3
answers2051
viewsA: Difference between dates on multiple lines
Try to do it this way declare @Tabela1 table ( ROW int IDENTITY(1,1) NOT NULL, -- Se sua tabela tive um campo IDENTITY(1,1) use ele NUM varchar(10) null, CLIENTE varchar(10), EMISSAO date ) insert…
-
1
votes3
answers2033
viewsA: SQL command inside a variable varchar - sql server
Do. declare @DS_PERFIL varchar(100) = 'teste', @id_Resource int = 1, @SeuValor varchar(100) =' Seu Valor', @STRING_SQL varchar(max) Set @STRING_SQL = 'update BCS_RESOURCE set DS_DESCRICAO = ''Gestão…
sql-serveranswered Marco Souza 12,304 -
1
votes2
answers1086
viewsA: Transform Json return to list of C#objects
You can do the following. public class ChampionsList { public List<Champions> Champions { get; set; } } public class Champions { [JsonProperty(PropertyName = "Id")] public string Id { get;…
-
0
votes1
answer77
viewsQ: Error while trying to update Visual Studio 2015 / Framework to version 4.6.1
I downloaded the visual Studio 2015 and everything was fine, but unfortunately I work with a shared machine and the other user ended up deleting the installations of . Netframework 4.6.1 , now I’m…
-
0
votes1
answer140
viewsA: Swap rows for columns
You’ll have to do something this way. DECLARE @_MES INT = 1 DECLARE @_ANO INT = 2016 DECLARE @_DATAINI AS DATETIME = CONVERT(DATETIME, '01/' + REPLICATE('0', 2 - LEN(@_MES)) + CAST(@_MES AS…
-
2
votes2
answers794
viewsA: Get information from the customer
In the C# in Assembly: System.Web has the class Request, that you can use to capture various information from Client. For example the IP. String IP = Request.UserHostAddress; See the Property list.…
-
3
votes1
answer4453
viewsA: Copy string from a position
This error occurs because you are trying to recover a part of the String that does not exist. Take the case String item = "0123456789"; // o Length da sua String é 10; int _int = 3; // inicio da…
c#answered Marco Souza 12,304 -
-1
votes3
answers3103
viewsA: How to perform UPDATE with ORDER BY on sql server?
UPDATE com ORDER BY On the question raised in the title: There is no ORDER BY in a SQL UPDATE comando. Postgres updates lines in arbitrary order. But you have options (limited) to decide whether…
-
1
votes1
answer749
viewsA: The various part identifier "System.Data.Datarowview" cannot be associated
Try to do it this way. if (cmbFavorecido.SelectedValue != null) { SqlConnection conn = new SqlConnection(); conn.ConnectionString = myConnString; try { String txtID =…
-
0
votes2
answers619
viewsA: Stored Procedure for log data insertion
Basically you just need the following. CREATE Proc [dbo].[sp_LogUsuario_Update] @IdUsuario int, @DtInclusao int -- se precisa de mais campo adicione aqui. as begin Set Xact_Abort on Set Nocount on…
-
2
votes1
answer175
viewsA: create custom mask unity3D
Evandro don’t know what you call a Function using unity3D, but the Function below does what you need. function mdata(v) { v = v.replace(/\D/g, ""); //Remove tudo o que não é dígito v =…
-
2
votes1
answer227
viewsA: Error updating a table. (Duplicate key)
Yes I already have a record in the table with those values, but when changing the guy shouldn’t let me do? No, what you have to do is use one Where , that is to say. Update Falta_Licao set Tipo = 1,…
-
0
votes2
answers90
viewsA: Doubt with cast sql server 2008
You can use the CAST, as below. declare @TB_PRODUTO table ( CODIGO int, DESCONTO01 decimal (12, 4), DESCONTO02 decimal (12, 4), DESCONTO03 decimal (12, 4), DESCONTO04 decimal (12, 4), DESCONTO05…
sql-serveranswered Marco Souza 12,304 -
0
votes3
answers3337
viewsA: INNER JOIN is duplicating record
If your data is actually duplicated in the tables you can use the distinct, select distinct…
-
0
votes1
answer131
viewsA: How to make a lambda pivot in a C#list
Try to do the GroupBy and then a Select to join its columns in a single if that is its purpose. . using System; using System.Collections.Generic; using System.Linq; using System.Web.UI; namespace…
-
0
votes1
answer705
viewsA: How to join the two tables in this case?
Try to do. SELECT inscricao,[1_BIM],[2_BIM],[3_BIM],[4_BIM], Nome FROM ( SELECT inscricao, idteste, nota_num, a.Nome FROM [EasyNovo].[dbo].[faz_teste] ft join [EasyNovo].[dbo].[alunos] a on…
-
9
votes2
answers8268
viewsA: Select with the day of the week in Portuguese
Just use lc_time_names = 'pt_PT'; SET lc_time_names = 'pt_PT'; Select DAYNAME(NOW()) AS dia, year(NOW()) AS ano, (CASE month(NOW()) when 1 then 'Janeiro' when 2 then 'Fevereiro' when 3 then 'Março'…
-
1
votes2
answers272
viewsA: Query in two tables at the same time
Advantageous is not, but also not so bad. The best would be you have your table Livrowith all the details of the book, if you will detail the chapters of the book in another table then you will have…
-
1
votes2
answers2812
viewsA: Decimal variable removing decimal places
I had the same problem these days, in my case I used javascript with regular expression to correct the error as follows. remove all text points. str = str.replace(/\./g, ""); changes a , by point…
-
1
votes3
answers21403
viewsA: Turn rows into columns with their respective values
You can be doing it this way. select idRegistro,Nome ,Email ,campoX,tel ,campoY INTO #tabelatemp from suatabela select * from #tabelatemp --where idRegistro = 1 More details here…
-
1
votes1
answer157
viewsQ: Which List Findall method is used in a Datatable
I have the following select below: var Filhos = FluxoWorkflow_ .FindAll(N => N.IdPai.GetValueOrDefault() == dr.IdFluxoWorkflow); I had to change my typed class to a DataTable I’m just not able to…
-
0
votes2
answers744
viewsA: Deletion of related data - Entity Framework and C#
Try to change your method as follows. public void Remove(Artista artista) { var artistas = Db.Artistas.First(x => x.ArtistaId == artista.ArtistaId); RemoverTelefones(artistas);…
-
1
votes1
answer77
viewsQ: Error while trying to add numbers in an int32 array
I am trying to store an array of ints to use periosteally, but came across a syntax error on the part . { 4, 7, 8, 9, 10 } private Int32[] m_FluxosPlataformas = null; public Int32[]…
-
2
votes1
answer344
viewsA: Insert/update with values from other tables
I didn’t quite understand your question because it is update in the title and context you use Insert, but come on, you can use select to do this as follows. Declare @disciplinas table (…
-
2
votes1
answer113
viewsA: Subquery with Linq
I would do extension method for this. public partial class VwClienteTelefone { public PFPJ PFPJ_ { get; set; } public pais pais_ { get; set; } public profissao profissao_ { get; set; } public…
-
2
votes1
answer1538
viewsA: Select min() returning value other than 0
In that case the solution is to use the Where. SELECT MIN(VALORTARIFA) MENORTARIFA FROM TABELA WHERE VALORTARIFA > 0
-
1
votes2
answers1020
viewsA: Problem to join two Selects in one instruction
You have two ways to do this. one is by using the JOIN and another would be a select with SubQuery. Answers: Subquery SELECT perfil_usuario_unificado.nome_fantasia,…
mysqlanswered Marco Souza 12,304 -
1
votes2
answers304
viewsA: How to store the Selecteditem value from Dropdownlist in the database?
As your field awaits a nvarchar, I suppose you want to pass the text "Male" or "Female". protected void rblSexo_SelectedIndexChanged(object sender, EventArgs e) { SqlConnection conn = new…
-
2
votes1
answer52
viewsQ: Converts string to numeric in javascript
I am trying to convert a string to a numeric, the point is that I have a mask in the string and the number is a large value so that the total value is not summed correctly. I need that after adding…
javascriptasked Marco Souza 12,304 -
3
votes3
answers713
viewsA: How to update page title with notifications?
Hello, you may be withdrawing your previous notification before placing the new one as follows. var title = document.getElementsByTagName("title")[0].innerHTML; title =…
javascriptanswered Marco Souza 12,304 -
2
votes1
answer402
viewsA: When choosing a company connect to the Database
You’ll have to change your ConnString at the event SelectedIndexChanged of your comboBox. This can be done as follows. using System; using System.Collections.Generic; using System.ComponentModel;…
-
0
votes1
answer309
viewsQ: jquery ui dialog does not expect confirmation
I’m wearing a ListView to generate buttons according to the IdPassoWorkflow, and show on the screen the buttons as per image below. When clicked, I open one dialog for the user confirms the action,…
-
4
votes1
answer4693
viewsA: There is a way to know the name of the Database Server
Yes. You can use the following select. select @@SERVERNAME, DB_NAME()
-
2
votes1
answer1116
viewsA: Create buttons at runtime
Hello, you can do it this way. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Botoes.aspx.cs" Inherits="WebApplication1tiraduvidas.Botoes" %> <!DOCTYPE html PUBLIC "-//W3C//DTD…
-
1
votes1
answer112
viewsQ: Jquery dialog not shown
I’m having trouble presenting a window of dialog onscreen. <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> <link rel="stylesheet"…
-
3
votes1
answer178
viewsQ: Javascript set value of one field in others
I have the following code below <script type="text/javascript"> function getValue() { var x = document.getElementById("NuJaneiro"); document.getElementById("NuFevereiro").value = x.value; }…
-
1
votes1
answer341
viewsA: How: Fill Object Collections from Multiple Sources
See an example below of how you can be doing this. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using…
-
3
votes1
answer931
viewsQ: Take the highest value within the Line select
Is there any way that inside the select do linq I can take the highest value of a field of the type decimal?, according to the code below? MaxValor = Math.Max(CF.Janeiro, CF.Fevereiro, CF.Marco,…