Questions tagged as 'c#'

1
answer

Doubt about methods

I'm learning from the book Use the Head and there is the following code to do an exercise of random items public class Menu { public Random Randomico; string[] Carnes = { "Rosbife", "Salame", "Peru", "Presunto", "Pas...
asked by 24.04.2018 / 17:00
2
answers

Error in SelectedValue of a dropdownlist in ASP.NET

I have a form in Asp.Net for registration of vehicles, where there are DropDownList that are filled with data from the bank. However, when you click on Write it returns the error    System.Exception: 'IT WAS NOT POSSIBLE TO RECORD   Sy...
asked by 19.09.2018 / 02:50
2
answers

Doubt integration test

I think it's a somewhat conceptual question on the subject, but come on: I have an example method that validates a user by checking whether it exists in the database, like this: public bool ValidaCampos(string Nome) { string str = "sele...
asked by 30.10.2018 / 20:02
2
answers

How to sort and list only 5 items in a list?

Well, I'm developing the dashboard of a web system, in one of the filters I should list the top 5 clients and sort them by the highest amount of totals of invoices issued. I'm already able to list quietly, the problem is that the filter is listi...
asked by 24.05.2018 / 20:37
2
answers

at and followed quotation marks in a string (exiting & quot; or # 39; in View)

I'm trying to put the following text in a string, but I can not ... when there is no error in the double quotation marks of the at ... to getting crazy. Can anyone help me?   , {       "@type": "ListItem",       "position": 2,       "item": {...
asked by 08.05.2018 / 19:48
2
answers

How do I stop a running program?

I have created a program that compresses files using 7z and how are several files within a loop and the program should compress 1 file at a time, I used WaitForExit() The program works perfectly, but now I'd like to put a cance...
asked by 14.05.2018 / 17:47
2
answers

How to check WHERE clause with apostrophe in a DELETE operation?

I need to delete a record, but in the WHERE clause one of the data has an apostrophe. How can I check this information, because it is obvious that it will give error. DELETE FROM IES WHERE IDENTIFICACAO ='456' AND ESTADO='SP' AND MUNICIPIO='SA...
asked by 07.08.2014 / 22:51
3
answers

Error while passing SqlParameter

I have a method to return a query , but it is giving error. Class Data.cs: public static SqlDataReader retornaQuery(SqlCommand query, List<SqlParameter> parameters) { try { //Instância...
asked by 08.08.2014 / 18:08
4
answers

Validate TextBox content

I have the TextBox fields, for example: txtValorCompra would have to be typed by user 98,90 and can not be letters txtNumero entry with integers % with only letters. Would you like to do this on the form?...
asked by 03.11.2014 / 22:44
2
answers

Find out if it is even or odd in array

I'm trying to set the even and odd numbers of a total of 5 numbers entered by the user into a vector. int[] atividade = new int[6]; for (int i = 1; i < 6; i++) { Console.WriteLine("Insira o " + i + "° num...
asked by 20.08.2017 / 04:37