Posts by Rovann Linhalis • 14,881 points
567 posts
-
4
votes1
answer195
viewsA: Report from a form with no database
Thinking of a simple, text-only printing and that no additional software like Crystal Reports is needed, you can use this function that generates the printing by C#itself. Simply inform the text…
-
1
votes2
answers298
viewsA: EF Core Relationships one-to-Many-to-Many Fluentapi
This way you’re doing it, it would look like this: public virtual Sala SalaResponsavel { get; private set; } public virtual Sala SalaSupervisor { get; private set; } public virtual Sala SalaGerente…
-
2
votes1
answer529
viewsA: Upload files with web browser c#
I believe you can get around the webbrowser when sending the file. From what I saw, the URL outage_upload.php awaits a request by POST that sends the file as a parameter. That is, you can send a…
-
1
votes2
answers718
viewsA: Form behind the Windows bar
Just complementing the response of Renan, who is right about the cause of Form’s behavior, you can circumvent this by disabling the button, or the buttons ControlBox at the event Load form. The Form…
-
1
votes1
answer340
viewsA: Restore Postgresql Database in C#
In the following line: const string arg = "-i - h localhost - p 5432 - U postgres - c - d dbrestore - v D:\bkp.backup"; was not placed @ before the string, which causes \ is a special character and…
postgresqlanswered Rovann Linhalis 14,881 -
7
votes1
answer788
viewsA: Error Object Reference not set to an instance of an Object
You are trying to save the image from the button btnSalvar instead of the image captured by the webcam. change: this.btnSalvar.Image.Save(fs,System.Drawing.Imaging.ImageFormat.Jpeg); for…
c#answered Rovann Linhalis 14,881 -
5
votes1
answer1322
viewsA: Select grouping by average hour and sum per day
Select the average per day: select avg(valor) as media, cast(data_hora as date) as dia from valores group by cast(data_hora as date); Select the average per day and hour: select avg(valor) as media,…
-
6
votes3
answers6281
viewsA: File . bat to generate backup and Restore in Postgresql
Considering: The name of the database as: minha_database The backup file as: C:\bkp\backup_database.dump Installation of Postgresql 9.1 in C:\Program Files (x86)\PostgreSQL To back up:…
-
4
votes2
answers122
viewsA: Is it correct in MVC to access data within the model?
Just one observation, if you have a method within the class itself, you don’t need to instantiate a new object: public class Cliente { public int Id { get; set; } public string Nome { get; set; }…
-
0
votes1
answer49
viewsA: Link line of txt file with selected in my chelistbox
For this, I use a function: public static void ImprimirArquivoWord(string arquivo, bool preview) { Microsoft.Office.Interop.Word.Application wordApp = new…
c#answered Rovann Linhalis 14,881 -
1
votes1
answer41
viewsA: Rescue button through id
Try a little Linq: this.Controls.OfType<Button>().FirstOrDefault(c => c.Name == "idButton"); Placing in a static method, as requested: public static Button GetButton(Form f, string id) {…
-
1
votes2
answers207
viewsA: ENTITY FRAMEWORK - make a query like SQL
I have no way to test it here, but I believe it can stay that way: Whereas you want the syntax for the same result of like 'teste%descricao': Context.Item.Where(c=>…
entity-frameworkanswered Rovann Linhalis 14,881 -
0
votes2
answers50
viewsA: How to send 1 object and 1 vector to a C# API with $http.post?
Try to put [Frombody] pro parameter to be passed in the Request body: public HttpResponseMessage Gerar([FromBody]Classe listProdutos)
-
2
votes1
answer287
viewsA: Load Combobox with concatenated string
Come on, come on... you have to bring the columns in your select, and you don’t even need String.Format : string cmdCarregar = "SELECT CONCAT(id_produto,' ', nome,' ', preco) as descricao,…
c#answered Rovann Linhalis 14,881 -
2
votes2
answers46
viewsA: Doubt with data return Asp.net API
The Insert user method returns a string with the code that was entered. You must store this value and then return it to Response. Try it like this: [HttpGet]…
asp.net-mvcanswered Rovann Linhalis 14,881 -
3
votes2
answers79
viewsA: Make selection from the results obtained from it
Considering the consultation by id_projeto = 1 can be done this way: select id_evento,id_projeto,nome_evento, 1 as prioridade from eventos where id_projeto =1 union select…
-
2
votes1
answer54
viewsA: personal I do not know where the syntax error of the line " Else " at the end ,could help me
We’re missing a } to close the first if <?php require("conexaobancodedados_Model.php"); $nomeEvento = $_POST['nome_evento']; $descricaoEvento = $_POST['descricao_evento']; $imagem =…
phpanswered Rovann Linhalis 14,881 -
1
votes1
answer103
viewsA: Database maintenance c#
I’ll give you how to do in a system, which does not work with any Framwork ORM: In the client database, I have a key: last_upd_sql which stores the code of the last database update that was…
-
0
votes2
answers1092
viewsA: How to use Insert with multiple C# SQL records
I advise you to study more SQL syntax. You can do as M.Bertolazo said, but for this, the fields have to be in order, and, be all fields of the table. The correct syntax is: "INSERT INTO TABELA…
-
3
votes1
answer102
viewsA: Executereader how to fill in the fields by searching
Without going too deep, just take the columns of the dataReader: public bool BuscarCliente(int id) { bool retorno = false; using (conn = new NpgsqlConnection(ConnString)) { conn.Open(); string…
c#answered Rovann Linhalis 14,881 -
1
votes1
answer41
viewsA: api result different from my site result
Check the configuration of culture because in Zure the decimal separator is the point (.) and local is comma (,). As in the parameter you pass values with separators, error may be happening while…
-
6
votes2
answers400
viewsA: How do I know if the screen is in "Extend" mode?
Just check if there’s more than one Screen: if (Screen.AllScreens.Length > 1) { //Estendido } else { //Duplicado, ou apenas 1 tela } You didn’t specify, but this code is for winforms because the…
c#answered Rovann Linhalis 14,881 -
2
votes2
answers467
viewsQ: Duplicate Select Postgresql output
I have a record that is a receipt, and in select, I want the line to come duplicated. Ex: Select * from recibos where codigo =1; Upshot: codigo|cliente|valor|emitente|data 1 Fulano 10 Ciclano…
-
1
votes2
answers467
viewsA: Duplicate Select Postgresql output
I got the result waiting using the following syntax: Select r.*, s.via from recibos r inner join generate_series(1,2) s(via) on 1=1 where codigo = 1; If anyone has another suggestion on how to get…
-
1
votes1
answer951
viewsA: How to do pg_dump remotely
If you have postgresql installed on your machine (or the necessary files), you can execute the same command by changing the parameter -h by your server’s ip/domain on Amazon. Noting that, may have…
-
0
votes2
answers77
viewsA: Error trying to save combobox and Masktextbox
Some points to change: 1- I would change the control, instead of a combobox, I would use a radioBox, it is simpler and you only store a Boolean: 2- Change the data type of the CPF, which can also be…
-
2
votes1
answer1557
viewsA: Send parameters to Restfull services
I use the following function: public static string HttpPost(string url, string postData, string token) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); byte[] data =…
-
3
votes1
answer112
viewsA: I made a sum with lambda and is not working as expected
If I understood correctly, you want that in each Itenslibdto has the sum value of all items, even if it is repeated, soon would so: double lucroTotal = lista.Sum(e => e.Lucro); lista.ForEach(e…
-
2
votes1
answer1720
viewsA: Standard Windows Form Actions [Minimize - Maximize - Close]
You can manipulate the Resize event: private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.Hide(); } else { this.Show();…
-
6
votes3
answers364
viewsA: Drag and Change Position of a Groupbox at Runtime
Looking fast here, would start by the event MouseMove: public Form1() { InitializeComponent(); groupBox1.MouseMove += groupBox1_MouseMove; } ... void groupBox1_MouseMove(object sender,…
-
1
votes3
answers2562
viewsA: Sum the values of a Count(*) in sql
Try it like this: SELECT A.Pais, count(*) as qtd_pais, (select count(*) from Aeroportos) as total from Aeroportos A group by A.Pais order by Pais; I believe it is not the right way because I think…
-
2
votes2
answers978
viewsA: How do I click the java script Alert ok via Webbrowser?
I will put it as another answer, because it is a different solution proposed in the first. That way, you can not click on the boxes, but prevent them from appearing: It was necessary to add the COM…
-
2
votes2
answers978
viewsA: How do I click the java script Alert ok via Webbrowser?
as I commented, the message is displayed by the browser, and you will not be able to access it by the document html. You need to use operating system functions to interact with messages: using…
-
0
votes1
answer406
viewsA: Web-Service returning maximum quota exceeded. How to resolve?
I had this error, but the problem was on the client side, and was just changing the security mode of basicHttpBinding: <basicHttpBinding> <binding name="WServicoSoapBinding">…
-
0
votes2
answers102
viewsA: Compare date field with current date in datagridviwer
Convert the cell value to Datetime, and then make the comparison: else if (DateTime.Parse(row.Cells["PROGRAMAÇÃO"].Value.ToString()) > DateTime.Now) { row.DefaultCellStyle.BackColor =…
c#answered Rovann Linhalis 14,881 -
1
votes1
answer69
viewsA: Postgresql/Visualstudio database modeling
You need a sales chart/os and a table of the items of that sale... 1:N simple cardinality ratio where a sale can have multiple items, and an item can be in only one sale. Sales chart:…
-
3
votes1
answer747
viewsA: Best way to implement Toledo Prix 4Uno scale?
I even took a look at her handbook: http://www.sotomano.com/produtos/arquivos/prix4uno-618.pdf I don’t think you need to develop a software to communicate with the balance, and the manufacturer…
-
2
votes1
answer82
viewsA: Nullreferenceexception when trying to write to database
nullException error is happening on conn.Close(); because the conn is void. An error occurred while trying to create it. I believe there’s only one missing = in the syntax in the connection string:…
-
0
votes4
answers1289
viewsA: How to write a Datetimepicker to the database
just change Convert.ToDateTime(dtpData.DataBindings) for dtpData.Value Unless mistaken, if the field is of type Date and you inform a datetime in the parameters will not have problems. But anyway,…
-
1
votes2
answers3639
viewsA: Export of CSV data
This code of yours, I believe is correct, I just find it unnecessary to replace the column name, and, use , or ; to separate the fields, not the pipe | but, okay. private string…
-
0
votes1
answer113
viewsA: left Outer Join in a clause or
trial: select B.coluna from A left outer join B on b.coluna = a.coluna or b.coluna = 0 trying to use the same syntax you used, I think it would look like this: select B.coluna from A, B where…
-
1
votes1
answer43
viewsA: Error when executing select with alias
The AT is part of the reserved words of the access engine. You can try to put it between crases: 'AT' List of reserved access words:…
-
3
votes2
answers12946
viewsA: How to limit decimal places using C#
If it is a string, with comma as decimal separator, put the CultureInfo in the Convert: decimal x = Convert.ToDecimal("1,41293", new CultureInfo("pt-BR")); Console.WriteLine(x.ToString("N3"));…
c#answered Rovann Linhalis 14,881 -
0
votes1
answer1057
viewsA: Write CSV file in a certain line passed by parameter c#
You can read the file, store each row in one List<>, fetch the line you need to change, and write to the file again. Remembering that the line index starts at 0. Follow the commented code:…
-
1
votes3
answers196
viewsA: Query listing the dates
I did the following query, see if it helps you: Select now()::date - i FROM generate_series(0,6*30) i(i) where EXTRACT('dow' from now()::date - i) = 0 Explaining: generate_series: Generate a series…
-
0
votes1
answer120
viewsA: Select field in Webbrowser
I was able to select the amount you need, despite the select do not have id, I made a "Pog" to validate by InnerText but, the site has not yet applied the selected value to the list, I could not…
-
1
votes3
answers1886
viewsA: Check if a date is valid
I think you can split the Maskedtextbox string into a split, using the '/' character, convert the numbers to integer and then validate. In the MaskedTextBox, the property TextMaskFormat should be…
c#answered Rovann Linhalis 14,881 -
4
votes2
answers287
viewsA: How to disable windows update in Delphi
windows update is a windows service, named after wuauserv. By default, it gets Stopped, and with manual boot type. To disable, you have to change the boot type to desativado and for that, just…
-
2
votes2
answers284
viewsA: How to compare two string by marking the differences?
I just started doing the code here, but I can’t stop to do that for now, follow the initial code: private void Comparar(RichTextBox rtb1, RichTextBox rtb2) { rtb1.ForeColor = Color.Black;…
-
2
votes1
answer123
viewsA: Change Gridview
it appears to be winforms, and you want to change the column title. You can do three ways, or change in the storedProcedure by placing alias: ID_Categoria as "Categoria", or modified from…