Questions tagged as 'c#'

1
answer

Make a foreach that does not repeat the same data

I have this foreach, in a table with more than 5000 records. There are only 6 types of business unit. I would like in foreach and linq, when a type of un appears, it loads and then no longer repeats it, ie, it loads another different one and so...
asked by 22.09.2014 / 16:50
1
answer

Disregard the header of a .csv file when importing into the database

I need at the time of reading a .csv file to disregard the header at the time of importing to the database how is it possible? I'm using the following code: linhaArquivo = arquivo.ReadLine(); campos = linhaArquivo.Split(new string[] { ";"...
asked by 17.09.2014 / 19:53
1
answer

How to check if a given ID exists in the database?

I am doing validations before importing a .csv file into the database via C #, I have already done a validation to ensure that the state code is an integer and I also need to check if there is the state code that is coming in .csv exists actuall...
asked by 17.09.2014 / 22:12
1
answer

___ ___ erkimt Error adding HttpPost the controller ______ qstntxt ___

I have a problem in time to add the attribute %code% on my controller. I mean, I can add the attribute without problems, but when I compile and go to the form registration I just can not access.

I get the following error:

  

Server Error in Application '/'.

     

Can not find the resource.

     

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could not be removed, had its name changed, or is temporarily unavailable. Examine the URL and make sure that it is spelled correctly.

     

requested URL: / User / add

Version Information: Microsoft .NET Framework Version: 4.0.30319; ASP.NET:4.0.30319.33440

Also, when I take %code% % attribute, I can not see the registration form, but I can not do the insert in the bank.

    
______ ___ azszpr31034

When you add the HttpPost attribute in an action. It can only be accessed via the HTTP POST method.

If your intention is to only display the form. Do not decorate your method with no attributes, the default is GET.

What you can do is set an Add method with no attribute. This method will be accessed via GET and display the form.

Then you create a second method, for example AdicionarConfirmado, decorated with the attributes and HttpPost ActionName="Add"

The methods can no defined as follows

%pre%

Since your form that will save the record would look like this:

%pre%     
___

I have a problem in time to add the attribute [HttpPost] on my controller. I mean, I can add the attribute without problems, but when I compile and go to the form registration I just can not access. I get the following error:    Ser...
asked by 01.09.2014 / 04:06
1
answer

Two types of searches in the same textbox

I would like to know if you can search two types of variables (one at a time) in a single textbox. Example: public ActionResult Index(string pesquisa) { var usuario = from u in db.usuario select u; if (!String.IsNul...
asked by 04.09.2014 / 04:08
1
answer

Print arrays with line break

I want to print the various variables of a List . I am trying to use foreach but it has not worked. The variables are written one over the other instead of a line break. Look at my code in the printPage event: int charac...
asked by 07.11.2014 / 14:59
1
answer

C # Do select and display in a combobox

I'm creating an application in C # windows form and wanted to know how to do a select from a table and displayed a list of clients in a combobox.     
asked by 10.05.2014 / 15:33
1
answer

Something wrong with references using two layers in the Entity

I made an example in Entity 5.0 and with 1 layer worked perfect. Now I have separated in UI and DA L, but this is giving error. The same page that worked on the DAL layer when done in UI is giving error. I t...
asked by 20.03.2014 / 18:10
1
answer

Register via facebook api

I would like to know how to configure the facebook app so that it can receive the data of any user .. I tried unsuccessfully to define these 2 fields that facebook provides: FaceBookConnect.API_Key = ""; FaceBookConnect.API_Secret = ""; I j...
asked by 20.03.2014 / 05:54
3
answers

Receive one Model per parameter in a function

I'm trying to get a Model in a function, which passes from a view (although I do not know if it's possible) to be able to generate a list and generate a PDF. My View : @model List<BDOleoTorres.Models.AutoDeclaraco...
asked by 26.03.2014 / 12:21