Posts by Rovann Linhalis • 14,881 points
567 posts
-
2
votes1
answer146
viewsA: Topmost Windows Forms
If both are defined as TopMost, will always be on top the last one that was focused or the last one that was opened. But if you want to open the window2, the window1 appears on top, you can call the…
-
2
votes2
answers2463
viewsA: Mysql select multiple columns from the same table with conditions
1-Option: Union (only if same data type) SELECT nome, cpf, rg FROM pessoas where tipo = 1 UNION SELECT razao, cnpj, ie FROM pessoas where tipo = 2; Option: Coalesce (if fields are null when of…
-
0
votes1
answer350
viewsA: Condition and loop within a function
Solved: My problem was knowing the syntax for the function. To language was set to sql, thus would not support conditional and loop. I had to change to plpgsql, and this did not support the…
-
0
votes1
answer350
viewsQ: Condition and loop within a function
I am creating a function to exit the stock, where v_saldo_item_peps is a function that returns a table, with the items that have balance, in their respective entries. I need to check whether…
-
0
votes1
answer290
viewsA: How to do a search in c#?
Considering the Search method within the Article class, it should look like this: public static Artigo Pesquisar(int _id) { Artigo obj = new Artigo(); SqlConnection conexao = new…
c#answered Rovann Linhalis 14,881 -
2
votes1
answer1338
viewsA: Calculate Mysql percentage
Without changing much, you can do with a subselect: SELECT SUM(r.valor_receita) AS valor_receita, ((SUM(r.valor_receita)/(SELECT SUM(x.valor_receita) FROM receitas x WHERE YEAR(x.data_vencimento)…
-
0
votes3
answers79
viewsA: What would the conversion of this algorithm look like from c to c#?
I made a code using List<> and a Class for Students, follows the code: namespace CadastroAlunos { class Program { static void Main(string[] args) { int Lim = 2; double somaTurma = 0; double…
-
3
votes2
answers190
viewsA: Postgresql COUNT function does not work
By the way, when you leave with the group by returns 6 lines, with the result 6 in each of them, correct ? you can use the distinct for that. ps. Try to match the code to help read. SELECT…
-
1
votes1
answer470
viewsA: I cannot do a function that returns a Semester of a Date in Postgresql
You are trying to compare a timestamp with a whole, you have to compare only the month. do so: if date_part('month',data ) <=6 That would be the job: CREATE or REPLACE FUNCTION semestre ( data…
-
4
votes2
answers83
viewsA: I don’t understand why it doesn’t work
In your for code, do the instantiation of Scanner again: for (int contador = 0; contador < 5; contador++) { System.out.println("Insira o primeiro nome, segundo nome e idade:"); Scanner sc = new…
javaanswered Rovann Linhalis 14,881 -
1
votes2
answers121
viewsA: Working with C#; images
I would make a List, Stack or Image Queue in just one Picturebox, and when an error occurs, advance to the next image. I made a very simple code, where the error happens at the click of the button:…
-
1
votes2
answers169
viewsA: Show date in Messagebox C#
because of @ in variable name ? if you have an array of dates, it would look like this: DateTime[] datas = new DateTime[5]; string msg = ""; for(int i =0; i< datas.Lenght; i++) msg +=…
-
0
votes1
answer52
viewsA: Insert MYSQL error by data grid view
Before the amount of VALUES is different from the number of columns in the INSERT, you are not informing the column to the field NomeProd. And where do you pick up row.Cells["R$ Unidade"].Value I…
-
0
votes1
answer55
viewsA: RTF formatting.
You need to convert the RTF value to HTML and not take the RTF Text value. for example, onte has a paragraph in the RTF \par in HTML you have to put a <p></p>. See these articles:…
-
0
votes2
answers939
viewsA: I can’t find a resolution for that mistake
remove internal UsuarioForm() place public UsuarioForm()
-
1
votes1
answer40
viewsA: Duplicate data in response to a query
It is only showing the value of the items by the Key and Index of each one, it is not duplicated, or you use the Keys or the indexes to access the values
-
0
votes1
answer98
viewsA: Question for SQL Server - Code
I made something very simple to try to help you first with the structure of your database, then we will see the SQL commands for this. See the model and any doubt, just talk. I made it very simple…
-
1
votes3
answers575
viewsA: EPSON non fiscal thermal printer does not work in a shared way with USB and LPT
On the issue of error Permission denied I believe you can solve with security options and users. Edit Try this: Printer Properties > Security > Add > Advanced... > Find Now > Select…
-
0
votes1
answer316
viewsA: INSERT with database information inside another C#database
The correct is: "INSERT INTO bancos(nome,diretorio,hora) VALUES ('" + check.ToString() + "','"+horarioBox+"' + '"+locationTextBox.Text + "');"; and not VALUES = 'TESTE','TESTE','TESTE' ps. Prefer to…
-
1
votes2
answers34
viewsA: Problem in SQL statement
In Where, you enter the clause of table G. Also change the order of coalesce, within the Sum(). and when passing the parameters, do not enter the group by, there is no aggregation function in the…
-
32
votes1
answer21108
viewsA: What is the purpose of the RESTRICT, CASCADE, SET NULL and NO ACTION options?
These are options for foreign keys, trying to simplify to the maximum: RESTRICT: Reject updating or deleting a record from the parent table if there are records in the child table. CASCADE: Updates…
-
0
votes2
answers189
viewsA: Back up more than one database. c#
You use the property CheckedItems.Count to check if there are any items selected, Open the connection to your base, and scroll through the selected items by performing the processing you need.…
c#answered Rovann Linhalis 14,881 -
0
votes3
answers925
viewsA: Search name by first and last name
Try to replace the spaces by replacing them with the joker: php: str_replace (' ' , '%' , $pesquisa ) mysql REPLACE(pesquisa,' ','%') Editing: use the RLIKE command, but it can return unwanted…
-
0
votes2
answers783
viewsA: What better way to align columns of Datagridview C#
I use: dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; Column widths are adjusted so that the contents of all cells in the columns, including the header cells, fit into it.…
c#answered Rovann Linhalis 14,881 -
3
votes2
answers1808
viewsA: second degree equation c#
because with these values the delta gets zeroed and enters your if that has no output. else if (delta == 0) { //Entrou nesse if e não faz mais nada x1 = -b / (2 * a); vx = x1; //alguma saída ? }…
c#answered Rovann Linhalis 14,881 -
1
votes1
answer356
viewsA: Visual Heritage of Windows Form
Yes, to edit the added controls in the parent form, change the properties MODIFIERS of these controls to PUBLIC.
-
4
votes1
answer73
viewsA: How to make the computer choose between two Characters
Use Random, and test whether it is even or odd. And assign a matching Character, Ex: "X" when even, and "O" when odd. Random from 0 to 99, 100 possibilities, equal probability. Random r = new…
-
1
votes1
answer44
viewsA: Problem with for and string. Remove
Trying to understand what you are doing, the values of the vector would be these then (in bold), what is in Italian was removed by the Remove function(): az[0] = 2537…
-
1
votes2
answers682
viewsA: Transfer of Socket Files c#
I have something similar, but the information is different. I use MLLP to transfer the files completely. Follow the implementation: public class SiMLLP { private static byte[] StartBlock = new…
-
2
votes2
answers36
viewsA: Search WEB date only
Edit: You can keep your method as it is, and when calling it, just ignore the hours: public static DateTime GetNistTime() { var myHttpWebRequest =…
-
0
votes1
answer162
viewsA: Update Label of a Window through the Contents of a Usercontrol Combobox
First you must create the "Selectionchanged" event for your userControl, and when the combobox fires this event, it will be passed to userControl. See the example of a userControl: public partial…
-
3
votes2
answers3189
viewsA: See if there is a file in a folder c#
Just make a copy of the file to a folder and run this one that was copied. I didn’t understand your code, but I made an example to try to help you. private void AbrirArquivo() { string arquivo =…
c#answered Rovann Linhalis 14,881 -
8
votes2
answers2991
viewsA: SQL for last month and last two months
Last month: SELECT id, data, lote, modelo, qtd FROM controle_diario *WHERE MONTH(data)=(MONTH(NOW())-1)* Current year: SELECT id, data, lote, modelo, qtd FROM controle_diario WHERE…
-
1
votes2
answers423
viewsA: How to form a number to have 10 decimal places?
String value = String.format("Dez casas decimais: %1$.10f",10/3d); System.out.println(value);
javaanswered Rovann Linhalis 14,881 -
1
votes1
answer53
viewsA: Dataset does not recognize LIKE and search parameters
If the chunk '%@RA%' should be replaced by the parameter you will enter, leave it out of simple quotes. Example: string sql = "SELECT * FROM aluno where RA LIKE @RA"; cmd = new MySqlCommand(sql,…
-
0
votes2
answers710
viewsA: Operator in postgres function returns SQL Error [42883]: ERROR: operator does not exist: integer = integer[]
Use the unnest(anyarray) function, it will expand the array into several lines. Documentation: https://www.postgresql.org/docs/9.2/static/functions-array.html Try it like this: CREATE OR REPLACE…
-
1
votes1
answer67
viewsA: How to stop a windows Forms application until a form is closed?
To "block" the application while waiting for the result of Form1, swap the .Show for .ShowDialog().
-
0
votes1
answer198
viewsA: How to make a background responsive in c#?
In Form you have a property BackgroundImageLayout see what your situation is. I imagine it will be Stretch
-
1
votes1
answer878
viewsA: Delete in sql - Inner Join
In your situation, the recommended would be a FK with Cascade on delete, the bank will take care of doing this. But still if you’re not going to use the bank’s resources, at the helm, I imagine…
-
0
votes1
answer319
viewsA: Update Chart with data from a column in Gridview
Considering that you are using Datatable as the data source of your dataGridView, I think there is a problem in adding a column manually to the controller, and fill it with the data, as it will not…
-
0
votes1
answer46
viewsA: Problem sending PHP to Mysql
1-Then change the if($_POST['tipo'] == 'cadastro.html') for if($_POST['tipo'] == 'cadastro') because in the value of the type field, it is only 'register' 2-As for the possibility of being problem…
-
6
votes8
answers29160
viewsA: Duplicate visual line studio
There’s an extension to that: https://marketplace.visualstudio.com/items?itemName=ctlajoie.DuplicateSelection After installing, go to: Tools > Options > Environment > Keyboard. search for…
visual-studio-2015answered Rovann Linhalis 14,881 -
2
votes1
answer40
viewsA: Size of the form other than programmed
Check the Form Autoscalemode property. https://msdn.microsoft.com/pt-br/library/system.windows.forms.autoscalemode(v=vs.110). aspx…
-
0
votes1
answer640
viewsA: How to select the records of a high box table in postgres?
Selects all records that are different when you play them in a Lower function. Example: SELECT * FROM tabela WHERE LOWER(numero_fci) != numero_fci
-
1
votes2
answers87
viewsA: Query INNER JOIN apply bind parameter
Try: $stmt = $conn->prepare ("SELECT quantity.order_id, quantity.ISBN, quantity.quantity,orders.customer_id, orders.created, orders.status FROM orders INNER JOIN quantity ON…
-
1
votes1
answer322
viewsA: Conversion to date Postgresql
I thought of two ways to solve your problem: 1- A single function that gives replace in the month and puts a number in place: CREATE OR REPLACE FUNCTION public.ConverteMesPT (varchar) RETURNS…
-
0
votes2
answers1339
viewsA: Field check Combobox, Textbox Maskedtextbox
Use a recursive function, so that you go through the control and your children: public static bool CamposVazios(Control _ctrl) { foreach (Control c in _ctrl.Controls) { if (c is TextBox) { if…
-
1
votes4
answers5462
viewsA: how to insert picture into database
Use the BYTEA type which is an array of bytes. As for the language Lua, I can’t speak to you, but in C#, just pass the byte[] as a normal parameter. Tip: Prefer to use separate picture table from…
-
0
votes3
answers181
viewsA: Sum of a column is not giving the expected value
The problem is that in subquery you say the current line of table A when divided by whichever line of table B, the result is maior/igual to 1, you will add the value of column 1. Using the same…
-
1
votes1
answer424
viewsA: CPF Validation - Integration Services
You can use a SQL Server function ? /* Cristiano Martins Alves Para testar: SELECT DBO.CPF_VALIDO('16195473247') */ CREATE FUNCTION CPF_VALIDO(@CPF VARCHAR(11)) RETURNS CHAR(1) AS BEGIN DECLARE…