I’d like to insert a list of objects in an SQL table. I know this question here but I don’t understand. Here is my class : I’d like to know how could I insert my list using Dapper, I don’t want to iterate on the list and save them one by one, I would like to insert all of them
Tag: c#
Custom String Conversion
I want to convert a string that can have two formats. Example 1090512300 to 9.5.123 1090501300 to 9.5.13 The first string (1090512300) will always have the same length but the second(9.5.123) string won’t. The conversion logic is as follows 1 xx yy zzz 00 So string 1 will be 1xxyyzzz00 and string 2 xx.yy.zzz where all zeros have been removed.
Bulk insert using EntityFramework Extended
According to this, bulk insert in Entity can be made using the following code: I used SQL Profiler to verify how many insert queries were executed and I saw there was an insert for each element of the list. Why? Answer AddRange Add range doesn’t perform a BulkInsert, it simply DetectChanges once after all entities are added to the set.
Create SQL Server table from user-defined class [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last month. Improve this question I am creating a mini-ORM to learn reflection better in C#. Also I want to use Native & Pure C# and do
Convert SQL Integer into c# string for combobox (Access Database)
The following code gives me an IndexOutOfRange error. ‘Baujahr’ is an integer column in my access-database. cbFahrzeugBJ.Items.Add(reader[“Baujahr”].ToString()); Here the reader: OleDbDataReader …
C# win forms app hangs
The following code is for reading from an Access DB and transferring to a SQL DB. Can anyone tell me why this code just hangs after it is run ? I have a label that should change telling me the row that is being processed but the Form just sits and becomes unresponsive once I have clicked the button. Everything
System.Data.SqlClient.SqlException occured in System.Data.dll (incorrect syntax)
I can’t work out what the problem is here, since the additional information comes back as: Incorrect Syntax near ‘(‘. I think I need fresh eyes on this I can’t see the error. Here is my code, im …
Executing a SQL query with C#
I would like to add some information to my database. I searched for some tutorials, but none of them work. NonQuery can do what he needs to do, because the messagebox returns “Success” (1). But it does not update my database. If I put the same query to “Add New Query”, directly to my database, it works. Can someone help
Generic repository with Dapper
I’m trying to build a generic repository with Dapper. However, I have some difficulties to implement the CRUD-operations. Here is some code from the repository: As you can see, my delete-method takes a TEntity as parameter which is a parameter of type class. I call my Delete-method from my UserRepository like this: The thing is that I can’t write entity.Id
Entity framework query on just added but not saved values
I’m using Entity Framework from a couple of years and I have a little problem now. I add an entity to my table, with and here ok. Then, I’d like to make a query on MyTable, like The code above will query on my MyTable in the db. Is there a way to query also on the just added value,