Posts by Fernando • 1,027 points
42 posts
-
0
votes1
answer78
viewsA: Query Doubt in SQL Server 2012
From what I understand, you want to get the records whose ABC CURVE column value is not contained in the MODEL COLUMN To do this, just use one of the following conditions: Option 1:…
-
2
votes1
answer257
viewsA: C# How to Select and Color all text within a given line in Richtextbox?
Use the method Getfirstcharindexfromline to obtain the position at which a given line starts. To change the line color, do so: richTextBox1.Select(richTextBox1.GetFirstCharIndexFromLine(index),…
-
1
votes2
answers4225
viewsA: Convert Varchar to Time in SQL with data longer than 24 hours
Like your field tempo_indisponivel refers to time lengths which may contain values greater than 24h, it is not possible to convert it to the type Time. The field of the type Team in Sqlserver refers…
-
0
votes1
answer109
viewsA: Read and display a PDF inside a zipped folder without extracting it
It is possible to read the pdf that is inside a zipped folder without having to extract it. Just instantiate the object PdfReader using the object Stream of the desired file. var pdfReader = new…
-
0
votes1
answer2650
viewsA: Automatically leave dates in order
Automatically sort using VBA To implement the solution, it is necessary that the guide Desenvolvedor is enabled. If you haven’t done this yet, see how to Show the Developer tab. Taking as an example…
-
0
votes2
answers609
viewsA: For/Foreach Sql Server For Each Separate Column Data
A possible solution would be to use the function ROW_NUMBER() with Partition within a Common_table_expression (CTE) to generate sequential sales by company and then update the Sales table. The query…
-
4
votes2
answers1257
viewsA: Sql Server Error 8623: The query Processor Ran out of Internal Resources and could not Produce a query plan
According to the paper IN (Transact-SQL), of MS itself, this problem can occur when a clause IN possesses a very large number of values (many thousands of values separated by commas) within…
-
0
votes1
answer133
viewsA: Use TIMESTAMPDIFF in table creation
You need to declare the type that will store the function result. See the following tutorials: How To Use The Mysql Generated Columns CREATE TABLE and Generated Columns The correct syntax is as…
-
1
votes2
answers922
viewsA: Generate PDF in c# without using Microsoft.Office.Interop
I’ve already used iText to create Pdfs in Java. The C# version is iTextSharp which is available in free version (license AGPL) and commercial. Examples of use: Basic PDF Creation using iTextSharp…
-
0
votes2
answers1338
viewsA: T SQL Merge Two Lines in One
Suggestion 1 If the column untitled2 is a sequential for records of the same id, query can be the following: select t1.untitled1 ,t1.untitled2 ,t1.untitled3 ,t2.untitled2 as untitled3 ,t2.untitled3…
-
2
votes1
answer146
viewsA: Use variable value not yet declared. Circular Reference in c#
This is a typical linear programming problem and there are several algorithms to solve it. You could use, for example, a Simplex maximization algorithm. Many people prefer to use Excel to solve this…
-
0
votes3
answers412
viewsA: Filter records via datetime and bring them between an initial and final date
First you need to create a subquery that returns the date/time of the last movement of each day of the requested interval. The example below shows what should be the result of the subquery based on…
-
5
votes1
answer1637
viewsA: Number in full for number
Based on the examples listed in the question comments, I created the routine below to convert the number to full int. In short, the routine works as follows: it breaks the text in words and searches…
-
0
votes2
answers132
viewsA: Conditions in the SQL
Taking the tables as an example: produto unid_prod cd_prod descricao cd_prod fator_preco unid_vda ------- ------------ ------- ----------- -------- p1 Produto 1 p1 1 CX p2 Produto 2 p1 1 UN p3…
-
0
votes3
answers4298
viewsA: Count values from one column based on a filter from another column
Reading your question, I understood that you would like to implement a table that would have the following result: Solution 1 Place the following formula in column C: =SE( CONT.SE(A:A;B2) > 0 ;…
-
0
votes1
answer679
viewsA: Copy columns from matching rows
The macro below is a generic macro to transpose values that are organized in columns to rows. Using as an example your question, where values are organized in columns of months: País Jan Fev Mar…
-
3
votes2
answers2142
viewsA: Logic to validate free schedules on schedule
To check if a date range is free, you need to check that the interval does not match the other recorded intervals. There is a simple way to check if there is an intersection between two date…
-
2
votes2
answers320
viewsA: List tables in a single SQL Server query
Using SELECT subq.* ,QtdTransgressoes = (SELECT COUNT(DISTINCT tra.Transgressor_Id) FROM classification as cla JOIN trangressor_list as tra ON tra.Battle_Id = cla.Battle_Id WHERE cla.Player_Id =…
sql-serveranswered Fernando 1,027 -
1
votes2
answers1233
viewsA: Date Working Hours - SQL Server
If we consider working hours worked encompassing hours, minutes and seconds, the routine becomes a little more complex. To answer your question, I have adapted a routine that returns the working…
-
0
votes1
answer107
viewsA: Error inserting data from an excel file into sql
If the Excel column contains Date, or Time, or DateTime, regardless of format, ACE.OLEDB will always map it to a type DateTime. So the conversion error is occurring because the column TransTime in…
-
0
votes2
answers238
views -
0
votes5
answers833
viewsA: How to calculate the date and shift code?
It is possible to find the turn of each release by making a direct relationship between the tables lançamentos and turnos. It may seem like a more complex solution, but it leaves the generic query,…
-
0
votes2
answers1003
viewsA: How to display total rows of a table in a label
A simple way is to use the method Executescalar to obtain the value of Count(*) var comando = new SqlCommand("SELECT count(*) FROM Active", conn); label19.Text = comando.ExecuteScalar().ToString();…
-
2
votes1
answer98
viewsA: How to Bulkcopy an excel file to an sql table
I didn’t quite understand the reason for yours comboBox2.Text. Anyway, you need to map the worksheet columns with the BD table columns, as follows:. Change the connection string with Excel by…
-
2
votes3
answers636
viewsA: Load grid information in textbox in a form that is already open c# windows form
If I understand correctly, you want to open a form to do a customer survey and return the selected client to the calling form. If so, you can implement it as follows: In the Search Form: public…
-
2
votes1
answer233
viewsA: Query a specific node of an XML file in c#
Follow the example in XPATH to check if there is a Node Usuario with the User_Login and Password desired: string usuario = "pbteste"; string senha = "01234x"; XmlNodeList nodeList =…
-
1
votes1
answer514
viewsA: Listbox - Multiply values and move to another Listbox
First, you need to create a property in the form frmQuantidade so that the calling form can have access to the amount that was typed by the user. The implementation of property Qtde can be done as…
-
1
votes3
answers569
viewsA: Listbox - how to show full product name and bring up another column of values
If you have the option to use ListView, then I guess I’d better use it in that case. The code below shows how you can move items from a listview to another. I left the option MultiSelect = true to…
-
1
votes2
answers68
viewsA: excell’s formula
To turn the third list into the equivalent scale of the first two, you can use the following formula: ValorLista3/30+5 Taking the table below as an example: The formulas could be like this:…
-
0
votes2
answers318
viewsA: How to load values in the combobox by the form load event C#
I can only see one cause for trouble: you nay associated the method frmAdicionarProdutos_Load to the event Form.Load this.Load += new System.EventHandler(this.frmAdicionarProdutos_Load); I tested…
-
4
votes1
answer822
viewsA: How to Print an Array in Windows Forms of Visual Studio?
You need to assemble the array row before adding it to listbox: for (int i = 0; i < Qtdlinha; i++) { string linha = ""; for (int j = 0; j < Qtdcoluna; j++) { linha += " " + MAdjacencia[i, j] +…
-
1
votes1
answer797
viewsA: Passing parameters to an executable
If you want to change string values that are inside the executable, you can do the following: 1) Convert the executable to an IL file (Intermediate language); 2) Search/replace the IL file. 3)…
-
0
votes1
answer222
viewsA: Problem with Stack Algorithm
You need to clean the pile, elements.Clear(), after analyzing each line. while ((input = sr.ReadLine()) != null) { foreach (char c in input) { ... } ... elements.Clear(); }…
-
1
votes2
answers51
viewsA: Filtering through empty children
If, for example, we define that situacaoAcademicaID = -1 returns the requirements that do not have informed Academic Status, you can implement so: var pLista = bll.Query(p =>…
-
1
votes1
answer112
viewsA: Error reading text file line by line
An option to read the whole file at once and load it into an array is: var arrLinhas = File.ReadAllLines(@"C:\Desenv\Texto.txt"); A suggestion to save memory would be nay load all objects into the…
-
0
votes1
answer918
viewsA: Object Reference not set to an instance of an Object
The objective of DependencyService is to facilitate the creation of APP that accesses specific API’s of each platform (Android, IOS, Windows Mobile, etc). If the study you are doing does not require…
-
1
votes1
answer87
viewsA: How to write data from an excel to an xml file
//using System.Xml; //using System.Data; //using System.Data.OleDb; private void ExcelToXML() { var fileNameExcel = @"C:\Desenv\Pasta1.xlsx"; var fileNameXML =…
-
2
votes1
answer505
viewsA: Converting DOCX File to PDF C#
It is very easy to use the library Microsoft.Office.Interop.Word to convert to PDF. However, it is necessary that MS-Word is installed on the machine where to run the application. An example of code…
-
4
votes2
answers284
viewsA: How to compare two string by marking the differences?
You can use a library that manages textual comparison. The library google-diff-match-patch is available in several languages. To use the C#version, just download the latest version of the file…
-
1
votes1
answer304
viewsA: Disable action on mouse move C#
Remove the association between the event MouseMove listbox and the method lstColunasLayout2_MouseMove. To do so, delete the following line from your code: this.lstColunasLayout2.MouseMove += new…
-
2
votes1
answer86
viewsA: How to read an excel file and map
private void preencherDataGridView() { var fileName = @"C:\Desenv\Pasta1.xlsx"; var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended…
-
2
votes4
answers5144
viewsA: What does the "@" sign on C" mean?
To better understand the representation of strings in C#, I suggest reading the articles: String (Reference of C#) and String literals Briefly, C# supports two types of string representation:…