Posts by Marcelo Monteiro • 120 points
10 posts
-
0
votes1
answer145
viewsQ: Entity Framework. Select only 1 from a list in Include?
I’m only trying to get a 1 record of the Phones and Emails lists. var lista = Db.Oportunidades .Include(x => x.Conta.Proprietario) .Include(x => x.Conta.Contatos.Select(c => c.Telefones))…
-
1
votes1
answer247
viewsA: 12 month columns => 1 value column + 1 month column
Have you tried using UNPIVOT? CREATE TABLE tbl_teste (Al_Cta varchar(10), MoedCod int, TpVal int, FlagDC int, Month01 int, Month02 int, Month03 int); INSERT INTO tbl_teste VALUES ('AAAAA', 100, 20,…
sqlanswered Marcelo Monteiro 120 -
1
votes4
answers7295
viewsA: How to generate a spreadsheet from another using VBA
Luccas, I don’t know how many lines will be executed. But I would do so. A new CSV query to export CSV data, already breaking into columns by delimiter. With this, whenever you run, it just needs to…
-
1
votes1
answer102
viewsQ: Upgrade from many to many with EF 6
My problem is when I try to update an entity that has a child class that in turn has other children. The structure is this: public class Diagrama { [Key] public int Numero_Diagrama { get; set; }…
-
0
votes0
answers158
viewsQ: Instantiate Unit of Work with only 1 context. EF 6 Simple Injector
In a simple application, I have the code below that works up to a certain point, very well. However, for each Service that is instantiated to the Form, a new working unit is created, consequently a…
-
1
votes1
answer644
viewsA: Problems when working with dates in the database using a maskedtextbox in dd/MM/yyyy format
Leandro, Probably it is reversing the day and month in time to insert. The best way to work with date is to send the parameter in your command. Command.Parameters.Add(new…
-
3
votes3
answers2237
viewsA: Change column to indentity using T-SQL in SQL Server
Rodrigo, as far as I know, there’s no way to make this change without excluding and recreating the column. And to do this via script and keep the existing data I think would be unworkable. It would…
-
0
votes2
answers146
viewsQ: Context trying to delete the same record twice
I’m having a problem, actually it must be the same lack of knowledge, at the time of deleting a record using Entity Framework 6. When I try to delete a record that cannot be deleted because it has…
-
0
votes0
answers51
viewsQ: Transaction with Entity Framework. Saves 2 times after error
I am using transaction to make changes to the bank. My problem is when there is an error in saving time. If there is error at the time of inserting the drive it treats the correct way not saving…
-
2
votes1
answer59
viewsA: Is it possible to create individual events for the instances of a form in C#?
You have to pass as parameter even. Until because you will need to save the correct registration. public Form(string Tipo) { InitializeComponent(); } And passes on the call what you want: private…