Posts by Marco Souza • 12,304 points
506 posts
-
1
votes2
answers676
viewsA: Query does not sort records by Asc/Desc
This happens because the column Qtde is being filled in at runtime, because you are using COUNT(telpretot), try that way. declare @cadcha table ( nreg int, telefone int, telpretot numeric(18,2),…
-
4
votes3
answers2237
viewsA: Change column to indentity using T-SQL in SQL Server
If you want to enter an id automatically and then re-enter one by one you have to use SET IDENTITY INSERT (SQL Server Compact). It allows explicit values to be inserted into the identity column of a…
-
3
votes5
answers6773
viewsA: Separate ddd from phone with SQL statement
You can be doing this way : declare @contatos table ( ID_CONTATO_TELEFONE int, ID_CONTATO int, TIPO_TELEFONE varchar(1), DDD varchar(5), NUMERO varchar(100), IND_SITUACAO varchar(1), OBSERVACAO…
-
3
votes2
answers63
viewsA: "Nullreferenceexeption error was unhandled" when compiling
Felipe, the NullRedferenceExeption occurs when you try to reference an object (NULO) that does not exist in your code, if this occurs in this code snippet is surely in textBox1.Text, textBox2.Text…
-
3
votes1
answer157
viewsQ: Linq groups and fetch max id
Is there any way to optimize the code below so that you search the forms that have the maximum version according to the IdCentroCusto? In the code below I’m doing the grouping and catching the…
-
1
votes5
answers1583
viewsA: How to read data from the Mysql database of an application in c#?
See the example below... public DataTable PesquisarPorNome(string NomePesquisado) { SqlConnection conn = new SqlConnection(); conn.ConnectionString = myConnString; try { var SQL =…
-
1
votes1
answer729
viewsA: Error using Group by in a Mysql VIEW
This error occurs because the group by expects you to be grouping your data. For example, if you wanted to group all of a student’s grades during the school year, you could use the group by for that…
-
1
votes1
answer404
viewsQ: How to merge lines?
How can I merge two or more **Linhas x Coluna** of the consultation below? select cast(OS.CreateDate as date) as DtMovimentacao, OS.Id as NrOS, OS.Description Origem, OSI.Description as ItemSaida,…
-
1
votes1
answer506
viewsQ: Fixed Report Server Header
What is the property for the header in a report made on the report server to be repeated on all pages? As shown in the image below I want the yellow line to be repeated on all other pages. I’ve…
reporting-servicesasked Marco Souza 12,304 -
1
votes2
answers1494
viewsA: Delete record with duplicate (Id) leaving only one occurrence
VC can do a cursor as follows.. insert into tabela values (1 , 'JOSE'), (1 , 'JOSE' ), (2 , 'MARIA' ), (2 , 'MARIA' ), (1 , 'JOSE'), (1 , 'JOSE' ), (2 , 'MARIA' ), (2 , 'MARIA' ), (1 , 'JOSE'), (1 ,…
-
1
votes1
answer542
viewsA: Transfer List from one class to another
I don’t know how you’re carrying yours DataTable result, but I’ll give you an example using the sql server database for this. See below.. using System; using System.Collections.Generic; using…
-
2
votes2
answers80
viewsQ: Problem with Jquery dialog
I have a ListView which creates some buttons dynamically according to Idpassoworkflow, and as the step I need presents a message to the user confirms whether or not to execute the action, only that…
-
7
votes2
answers853
viewsQ: How to get Text from a Listview?
How can I catch the Text of my Label that is inside a ListView without using the FindControl (Item.FindControl("lblCodigoEdit") as Label).Text), or is access directly the value it has in mine…
-
3
votes3
answers2350
viewsQ: Add multiple items to a list
Is there any way to add several Intin a list<int>all at once? Type List<Int32> ContasNegativas = new List<Int32>(); ContasNegativas.AddRange(30301, 30302, 30303, 30304, 30305,…
-
4
votes2
answers514
viewsA: C# how to do database search using parameters
See the example below, public DataTable PesquisarPorNome(string NomePesquisado) { SqlConnection conn = new SqlConnection(); conn.ConnectionString = myConnString; try { var SQL =…
-
4
votes5
answers15132
viewsA: Change NULL value in SQL SERVER
You have two options to make that change. The first would be to check on your Select if the value of its columnar is NULL as follows. Select ISNULL(States ,'NONE') as States from suatabela ISNULL…
-
2
votes3
answers177
viewsA: Create a table with dates
You can check if it’s Monday that way.. if(dia == DayOfWeek.Saturday)
-
1
votes1
answer203
viewsQ: Sqlite native functions X Sugarrecord
What are the advantages and disadvantages of using SugarRecord when compared to native functions SQLite, Example when creating a table with Sqlite Native Functions DatabaseHelper.java public class…
-
1
votes1
answer272
viewsA: Fill in a collection type property
Well you’re trying to fill a class with a Enumerable, the first step and changes the select , because he brings a single list that would be the fields of his class and within that everything would…
-
1
votes1
answer2096
viewsQ: Delete a specified line from a Datatable
How can I delete a specific line from a DataTable and then reload a ViewState with the rest of the lines that stayed? I have the following case below, but am not getting deleta directly from…
-
6
votes1
answer1709
viewsQ: What’s the difference and benefits of using @@IDENTITY and OUTPUT INSERTED.ID
I’ve always used the @@IDENTITY to get the last inserted identity value, as in the example below. create Proc [dbo].[Arquivos] @IdArquivo int, @IdArquivo_Out int output as begin Set Xact_Abort on…
-
4
votes5
answers19374
viewsQ: How to check if a field of type text or ntext is null or empty?
How can I check whether a field of the type ntext is null or empty in where? I got the following select SELECT Subject, Notes from DocumentNotes where Notes is null or Notes = ' ' but when comparing…
-
0
votes1
answer1097
viewsQ: How to call the`Onclick` event in code Behind?
How can I call the event OnClick in the code behind of a dynamically created button? I’m trying it the way down, but I’m not getting it. void MontarHtml(List<DocumentoImagens> DocImagens) {…
-
2
votes3
answers3848
viewsA: I can’t connect localDB with visual studio
change your config web to <connectionStrings> <add name="EntidadesContext" connectionString="Server=.\SQLEXPRESS;Database=SeuBanco;user…
-
1
votes1
answer408
viewsA: Insert to foreign SQL keys
See the possibility to create a proc, I see is inserted data in the 3 tables of a single time, so you could do as follows... Create proc with the necessary parameters create Proc Cliente_Orcamento (…
-
1
votes1
answer381
viewsA: How do I save the value to decimals before the point in sql server?
This problem is occurring because the field created in SQL is numerical. Thus, the left zeros are ignored. Even if you loop to insert the zeros, you won’t be able to. One way to do this is to change…
-
1
votes2
answers141
viewsA: Select with Linq set the first characters in Where
The way found to do this was with the method StartsWith class String Stayed like this .Where(CC => CC.Clasificacao.StartsWith(ClasificacaoPai)) Source here…
-
1
votes2
answers141
viewsQ: Select with Linq set the first characters in Where
How can I define in Linq the same that I define in clausular Where do sql server in the form below .. select * from tb_CentrosCusto cc where cc.Clasificacao like '1.4.1%' In other words, I’m just…
-
2
votes1
answer1563
viewsQ: How to sort sql columns in alter table
I have a change to make in the table Inclusão de colunas the doubt is have as I set the order when I am making the change in sql server 2008 ? ALTER TABLE dbo.Arquivos ADD IdTipoDocumento int NULL,…
sql-serverasked Marco Souza 12,304 -
1
votes4
answers8633
viewsA: SQL query comparing two fields of the same table
I don’t know if I’m confusing here what you want... but you have two ana with a different ra, and you only want one ana I wouldn’t want the group by to have the result you showed, but if they were…
-
0
votes1
answer683
viewsQ: How can I set the width of each column in a Gridview?
How can I set the width of each column in one GridView in the following case below? <div style="width: 1000px; height: 400px; overflow: scroll"> <asp:GridView ID="Grid" runat="server"…
-
3
votes1
answer1218
viewsQ: How to run a query with large data volume?
Is there any way to run a file with a large volume of data without being direct on SQL Server 2014 Management Studio, because I try to open to run and get the following error: Cannot run script.…
sql-serverasked Marco Souza 12,304 -
1
votes2
answers1102
viewsA: Error while converting HTML to PDF
Your HTML this missing the closing tag . See below using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using…
-
3
votes1
answer1342
viewsQ: How to convert date to datetime?
I have the following case, I’m trying to convert the one field date for datetime using the update update tb_RHContratos set DtCadastro = cast(DtCadastro as datetime) But some of the date this does…
-
1
votes3
answers2001
viewsA: Error trying to send email
Hello try like this. protected void Page_Load(object sender, EventArgs e) { StringBuilder Body = new StringBuilder(); Body.Append("Aqui vai meu teste vamos ver se chega!!!!! :)"); String HostSmtp =…
-
2
votes3
answers321
viewsA: Pass List as LINQ expression parameter
You can do it like this; protected void Page_Load(object sender, EventArgs e) { cargarDados(1); } void cargarDados(Int32 disc) { List<Turmas> turmas = new List<Turmas>();//…
-
1
votes2
answers725
viewsA: How can I save TXT file in C: directory using C#?
System.IO.Path.GetTempPath() is just a wrapper for a native call to GetTempPath (..) in Kernel32 . Take a look link…
-
1
votes4
answers5546
viewsA: SQL query to get all records from last month but until the current day
Hello, see the example below how you can be doing declare @data datetime = (select getdate()) declare @ano int , @mes int set @mes = (select month(@data)) set @ano = (select year(@data)) DECLARE…
-
1
votes2
answers763
viewsQ: What is the best way to read a sql server error return?
How best to read an error return from sql server in a C# web form application? I got the following.. No sql server; END TRY BEGIN CATCH Raiserror('Erro ao gerar os dados', 18, 1); return; END CATCH;…
-
1
votes2
answers1980
viewsA: How to group results from a row query to columns
Hello, you can this using a cursor to do this. see how it would look. declare @tabela table ( id int , resposta varchar(100) ) declare @usuario table ( id int , nome varchar(100), telefone…
-
1
votes1
answer106
viewsA: Subquery returned more than 1 value. This is not permitted when the subquery Follows =, != , <, <= , >, >=
Hello, the return error refers to a query that returns more than one value when the expected is only 1. see the section below : SET @_body= ( SELECT body FROM Emails ) use the table id Emails with…
-
-1
votes1
answer539
viewsQ: How to display dynamic images from a Listview?
I created a div with a Listview where a Checkbox and a Imagery which are loaded into the Page_load. I need that by clicking on one of the Checkbox by selecting from the image, it is created…
-
1
votes1
answer1949
viewsA: Relationship intermediate table n for n
You can create the primary key with the combination of the keys of the tables involved and the rest of the fields get your need. take the example. CREATE TABLE [dbo].[Table_x]( [idtabelax] [int]…
-
2
votes1
answer170
viewsQ: How do you fix columns on a Listview?
I got the following Listview below, precise leaves the first 3 columns fixed and allow the rest to scroll. <td colspan="4"> <div class="GradeDados" style="position: relative; width: 1000px;…
-
1
votes1
answer562
viewsA: Setting up an SQL for School Report?
Hello, follow the example: declare @tabela table ( MATERIA varchar (40), NOTA decimal (10,2), PERIODO varchar (40) ) insert into @tabela values ('PORTUGUES ', 5.0 , '1Bim'), ('PORTUGUES ', 10.0 ,…
-
2
votes3
answers1283
viewsA: Remove Saturdays and Sundays from Calculation
Hello, use the Gregoriancalendar Class, see the example. public Boolean Verificadias() { // Pega o index do dia da semana... int IndexDia =…
-
2
votes3
answers2845
viewsA: Image to byte[]
in c# Image img = Image.FromFile(@"C:\nomeimagem.jpg"); byte[] arr; using (MemoryStream ms = new MemoryStream()) { img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); arr = ms.ToArray(); } source…
-
1
votes1
answer1012
viewsA: Get items from a List<String> - ASP.NET
I was in doubt of yours Dropdownlist and how you describe it in your code. "cbProcesso".. (cb) for me is initials of Checkbox ... but.... look at the way you’re carrying the Dropdownlist and also…
-
1
votes2
answers1278
viewsA: Capture selected Dropdownlist item
See how you’re carrying the ddlMenu utilize. int32 idMenu= ddlMenu.SelectedId(); and then do the switch case , probably your mistake is in the way you are carrying the DropDownList .…
-
0
votes2
answers188
viewsA: SQL Query Optimization in Mysql and Index
See if the query below helps. select D.HORA, COUNT(D.idBalanceteVersao) AS TOTAL_GERAL from ( SELECT '2015-10-14 '+ Horas.Hora +':00:00' AS HORA, idBalanceteVersao FROM ( SELECT '00' as Hora UNION…