Posts by Rovann Linhalis • 14,881 points
567 posts
-
2
votes2
answers495
viewsA: Separate a column of the database in two and take the values of users already created
Sim, you have some functions for string who do this: Example: select substring(trim(nome) from 0 for position(' ' in trim(nome))) as firstname, substring(trim(nome) from position(' ' in trim(nome))…
-
3
votes2
answers9821
viewsA: Select to display the column name of a table?
I believe that pro oracle you need to use the all_tab_cols, see: SELECT column_name FROM all_tab_cols WHERE table_name = 'tabela'…
-
2
votes1
answer421
viewsA: What is that vertical and horizontal line for when you click on the Form?
These rows are the row and column definitions of a Grid, and server to organize the layout of the application (View Image). You can add them by clicking on the outermost part of the component (an…
-
1
votes1
answer492
viewsA: Postback Asp.Net Webforms
You can, in every Load event of the page, check whether it is a postback or not. And then take the data that is in the dropdown source. Example: I used a Datatable as an example protected void…
-
2
votes1
answer854
viewsA: Select from time to time
You need the records where Start Time is between 8 and 8:30, OR, End Time is between 8 and 8:30 So we can have the following query: Select * from tabela where (horaini >= '8:00' and horaini <=…
-
3
votes2
answers1539
viewsA: Mysql Query with recursive N levels
In mysql, in versions >= 8, you can use a CTE (Common Table Expressions), which can be recursive. I made an example: with recursive aux (id , nome , user_id , i , seq ) as ( select id, name,…
-
1
votes1
answer217
viewsA: Comparison of Dates c#
You can compare the date, and if the date equals the lowest date of the same Patientid, is the first, if not, is change: Example: if (item.DataEdicao == Model.Where(x=> x.PatientId ==…
-
1
votes2
answers796
viewsA: Error inserting a "SELECT" item into the Combobox
How are you wearing a DataTable as source, you can add an extra line with the text and value you want. If you were using a list, it would be more complicated. I use this method: public static void…
-
0
votes1
answer92
viewsA: How to assign a database value to a new object in C#?
Except for a lot of problems in your code... you can remove that line: comboTipoConta.ValueMember = "id"; and thus use the allocation: conta.tipoConta = comboTipoConta.SelectedValue as TipoConta;…
-
1
votes3
answers3856
viewsA: Return month name as select
I use the following function: CREATE OR REPLACE FUNCTION public.namemonth ( integer ) RETURNS varchar AS $body$ SELECT Case $1 when 1 then 'Janeiro' when 2 then 'Fevereiro' when 3 then 'Março' when…
postgresqlanswered Rovann Linhalis 14,881 -
3
votes1
answer27
viewsA: Hello, I was trying to build a Textbox name from a string. Textbox+index
You want to access several TextBox that exist in your Form, dynamically, inside the loop. For this you will use the Method Find:…
c#answered Rovann Linhalis 14,881 -
2
votes1
answer2741
viewsA: pg_dump executed via windows command prompt
You didn’t inform the parameter -f specifying the file, the dump was only displayed at the prompt, and not saved. The correct command would be: C:\Arquivos de…
-
1
votes1
answer459
viewsA: INSERT in batch c#
There are several problems in your code, but I will focus on the loop, and although with an impractical practice (concatenate the query string) I will show an example of how your question would look…
c#answered Rovann Linhalis 14,881 -
9
votes5
answers453
viewsA: How to separate "words" in Camelcase in C#?
I made the following code, it is not as simple as @gato, but it can be more didactic. I hope it helps: public static void Main() { string camelCase = "CamelCase"; string newCamelCase=…
-
2
votes1
answer323
viewsA: How to handle different combobox data at runtime
The question is not very specific, but it has been clarified in the comments. Your real need would be to convert units by changing the value of the combobox. Based on the past code, I made the…
-
1
votes2
answers329
viewsA: What’s wrong with my code?
Perhaps there is confusion there as to whether a file is null. I understand that it is not possible, the file may be empty / blank / etc... Whereas you want to just search for the files in a folder,…
-
2
votes1
answer52
viewsA: Open file in a unique way c#
Simple, you can use Streamreader. Until you run the Close() method, the file will be blocked by the operating system. Code: using (StreamReader rd = new StreamReader("arquivo.txt",Encoding.Default))…
filing-cabinetanswered Rovann Linhalis 14,881 -
0
votes2
answers428
viewsA: The type must be a Reference type in order to use it as Parameter 'Tentity' in the Generic type or method 'Dbset<Tentity>'
You can make one class, that gets the Enum and that class is related to another that you need. In other words, it will be a class where your primary key will be Enum. I use the following code: A…
-
5
votes1
answer212
viewsA: Entity Framework Query Many to Many
You do not need to access this table, just make the query: var resultado = ctx.Livros.Include(l=> l.Autores).ToList(); or var resultado = ctx.Livros.Include("Autores").ToList(); For printing, for…
-
1
votes1
answer62
viewsA: Read a folder file and determine if it is the same as the website
In the local application you get the md5 of the file you need: public static string Md5FromFile(string input) { string saida = null; using (System.Security.Cryptography.MD5 md5Hasher =…
-
4
votes1
answer371
viewsA: Select columns with no specific name
You can use the command: DataTable dtCols = conexao.GetSchema("Columns"); or DataTable dtCols = conexao.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new Object[] {null, null, "NomeDaTabela", null});…
-
1
votes2
answers290
viewsA: How to Decrease Timespan Time?
Note: if you want 5 minutes, the parameter is the second of the constructor of TimeSpan. I imagine you’ve put the interval on timer1 for 1000 ms, Your code must be something like this: TimeSpan tp =…
-
1
votes1
answer95
viewsA: Performing a query C#
This is happening because your result is of the type dbquery. You have to execute the query after Where or Select using the method ToList() to return a collection, or the method FirstOrDefault() to…
-
1
votes1
answer156
viewsA: Duplicate data on datagrid
Set the property AutoGenerateColumns for false: <DataGrid x:Name="dataLocal" Margin="10,111,11,10" IsReadOnly="True" SelectionMode="Single" AutoGenerateColumns="False">…
-
0
votes1
answer447
viewsA: Problems with Backspace in Textbox
I guess I could use one MaskedTextBox that would suit you better in this situation. But answering the question: Just you change the if. I used the following condition: If the character is a number,…
-
1
votes4
answers534
viewsA: Help with distinct
I made an example by grouping only by nome, and using max(situacao), then use this table with Join in select to fetch the other data. See: select y.nome, x.data, y.situacao from tabela x inner join…
-
1
votes1
answer49
viewsA: Postgresql Database
Only one table has value to be added, so there is no question of "Add value X between 3 tables". You should do the Inner Join only to fetch the data from the tables credit_card and store, the value…
-
4
votes1
answer1785
viewsA: Url encryption
Answering the initial question: Using a md5 hash function, it could encrypt the user id: Function Md5FromStringUTF8: public static string Md5FromStringUTF8(string input) { string saida = null; using…
-
2
votes1
answer333
viewsA: Is there any way to create an environment variable by IIS?
You can set in your web.config, on the tag compilation, the attribute debug: In the development environment: <configuration> ... <system.web> <compilation debug="true" ... > ...…
-
2
votes2
answers40
viewsA: Returning the total with the date in a query with the SUM
Fields that are not in the aggregation functions, should be informed in the Group By, in his case the t.sale_date. Without this field, it works because there are none other than what is in the…
-
1
votes2
answers655
viewsA: Mysql parameter error with C#
Try with the following code: update itens set nritem = ( select aux.iterator from ( select @i:=@i+1 AS iterator, nritem, venda from itens, (SELECT @i:=0) AS foo where venda = 20) as aux where…
-
3
votes1
answer2393
viewsA: Copy folders with CMD space
Every folder / file by command prompt has a short name, which is always 6 'letters' + '~' + number by alphabetical order. Example: Folders: Program Files Program Files (x86) In CMD, they will be…
cmdanswered Rovann Linhalis 14,881 -
1
votes2
answers97
viewsA: How to assign a class to the whole and not just attributes separately?
In this scenario, you would have to call the object that way: Invoice obj = new Invoice(1); correct ? I suggest you create a static method that returns the object: public class Invoice { public…
-
0
votes1
answer404
viewsA: C# - If in Combobox Exercise Caelum
As Father Niero said, it’s very complicated there... kkkk, you have to understand what makes each code. Try to help you: comboTipoConta_SelectedIndexChanged is an event, that is, this code will be…
-
2
votes1
answer343
viewsA: Make global reference in C#
There are several ways to do this, including a pattern called Singleton that could meet depending on your case, I will put only one way, simple, but I think it gets "messy" then I would have to see…
-
2
votes3
answers14621
viewsA: Table does not break the line
Just set the table to table-layout:fixed and all the td for word-wrap:break-word Like the DataTables I used the following code for the table: <table id="example" class="display dataTable…
-
1
votes1
answer32
viewsA: Make sum of all searched data
The problem is in your loop that repeats the data. The sum is correct. Just remove the first foreach @{ //Remover esse -> foreach (var item in Model) foreach(var iten in Model) { <tr>…
-
0
votes2
answers56
viewsA: Difficulties in making select
I will try to do the query without validating it, I am without mysql here and without fiddle too... make a test The second result, I believe would look like this (I did not identify the column that…
-
1
votes1
answer1284
viewsA: How to check if user input is a negative number and display an error message?
Your problem is only logic. To close the reading, the 0 soon the while is wrong: The right thing would be: while(numero!=0) And, negative number or 0, should not enter the calculation, and should…
canswered Rovann Linhalis 14,881 -
4
votes1
answer1788
viewsQ: Entity Framework 7, Insert or Update
I’ve been looking for a method to check if an object exists in the base, if it exists, run a update, if there is no, insert. I couldn’t find anything anywhere that would suit me, so I made the…
-
1
votes1
answer281
viewsA: Error using System.Windows.Forms.SendKeys.Send("%{DOWN}")
Without getting into the question of SendKeys, I think the solution to your problem may be simpler: Change the properties of your Datetimepicker:…
-
2
votes2
answers155
viewsA: How to make Where ands dynamically with Linq and Entity Framework?
try with ternary operator: Syntax: ((bool) ? (se true) : (se falso)) [...].Where(p => (!string.IsNullOrEmpty(model.Nome) ? p.Nome.Contains(model.Nome) : p.Usuario.Contains(model.Usuario))).[...]…
-
0
votes2
answers1505
viewsA: Search file path C#?
If the file is in the same folder as the executable, use thus: FileInfo file = new FileInfo(Path.Combine(Application.StartupPath, @"Alarm.wav")); if (file.Exists) { SoundPlayer soundPlayer = new…
-
8
votes1
answer3990
viewsQ: Difference between Thread.Sleep and Task.Delay
I am developing a client/server communication, and using Task for asynchronous communication. Previously, I had already made another communication where I used Thread, works smoothly and consumes…
-
1
votes1
answer82
viewsA: How to check if the line was broken?
Basically you just check if the text space will be larger than the label width, and while it is, decreases the font. For this, you use the MeasureString class Graphics and a while, that decreases…
-
0
votes2
answers40
viewsA: Difficulty with Select
Try to put the distinct in function: SELECT Predio, Local, Produto, count(DISTINCT Produto) Qnt_de_PNs FROM Controle_Prod_P_Local_E_Predio WHERE Local BETWEEN ('LOCA"') AND ('LOCA_FINAL') AND Predio…
-
2
votes3
answers58
viewsA: SQL Query - Doubt Condition Dates
If I understand correctly: ?! select * from Tarefa where TarID = 173151 and MONTH(TarVencimento) = MONTH(DATEADD(MONTH,1,TarData))
-
3
votes1
answer162
viewsA: How to dynamically align the margin of a label via windowns form code?
Place the following properties on the label: //Auto size off, o tamanho da label, não vai seguir o tamanho do texto label1.AutoSize = false; //Dock = o tamanho da label, vai ficar ancorado no…
c#answered Rovann Linhalis 14,881 -
1
votes1
answer413
viewsA: How to use pseudonyms in queries using Aliases along with Mysql?
Now with the question edition, it became clearer. In this case, you can use the With: With tab1 as ( SELECT name,LEFT(occupation,1) AS letra FROM OCCUPATIONS ORDER BY name ) SELECT letra FROM tab1…
-
6
votes1
answer272
viewsQ: Sort list by string resemblance
I have a list of string: AAA BBB CCC ABB ABC ACC ACD The user will type what he is looking for, would like to take to the first positions, the most similar. Example: String: A Upshot: AAA ABB ABC…