ado.net

Affected Rows Entity Framework

How do I get the number of rows affected after a SaveChanges()? ...

Multiple Asynchronous SqlClient Operations - Looking for a good example

I have been using Asynchronous operations in my WinForms client since the beginning, but only for some operations. When the ExecuteReader or the ExecuteNonQuery completes, the callback delegate fires and everything works just fine. I've basically got two issues: 1) What is the best structure for dealing with this in a real-life system...

SqlBulkCopy Error handling / continue on error

I am trying to insert huge amount of data into SQL server. My destination table has an unique index called "Hash". I would like to replace my SqlDataAdapter implementation with SqlBulkCopy. In SqlDataAapter there is a property called "ContinueUpdateOnError", when set to true adapter.Update(table) will insert all the rows possible and ...

Call a store procedure from .net

I have a store procedure like this: CREATE PROCEDURE up_action (@id int ,@group varchar(30)='' ,@nom varchar(30)='' ,@compte varchar(30)=NULL ) AS BEGIN DECLARE @chrono int ...... select @date=date from users where compte=@compte INSERT INTO dialog (numappel,auteur,commentaire,etape,etapews,operant) VALUES (@numappel,@nomprenom,@dialog...

Why does one ADO.NET Excel query work and another does not?

I'm working on a SharePoint workflow, and the first step requires me to open an Excel workbook and read two things: a range of categories (from a range named, conveniently enough, Categories) and a category index (in the named range CategoryIndex). Categories is a list of roughly 100 cells, and CategoryIndex is a single cell. I'm using ...

Custom ServerSyncProvider

I there, I'm building an application that uses Sync Services for ado.net but as a requirement, my ServerSyncProvider can't have direct access to the database, instead, only business entities can. I'm thinking about building a custom ServerSyncProvider. Any tips on that? thanks ...

Would you use v3.5 of the ADO.NET Entity Framework, or wait for v4.0?

I was surprised to find a public letter proposing a vote of no confidence in the entity framework (see http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/) Would the reasons stated in the letter keep you from using the current version of the entity framework? Would you rather wait for v4.0? Or rather use anothe...

MARS vs NextResult

I rehydrate my business objects by collecting data from multiple tables, e.g., SELECT * FROM CaDataTable; SELECT * FROM NyDataTable; SELECT * FROM WaDataTable; and so on... (C# 3.5, SQL Server 2005) I have been using batches: void BatchReader() { string sql = "Select * From CaDataTable" + "Sel...

My datagrid's selection is lost when updating my database from the grid's bound dataset. Any workarounds?

I am using Xceed's Datagrid, bound to a dataset. I want to update the database when the datagrid's RowEditEnd is called. The problem is that in order to avoid concurrency violations when updating, I have to clear the dataset after update and refill it, like this: public void UpdateDatabaseFromDataSet() { adapter.Update(exampleDataSe...

How do ADO.NET DataTable Constraints affect performance?

Do constraints on a DataTable (e.g. PrimaryKey & UniqueContraint) make Selects more efficient in the same way that they would in SQL Server? Or is their only purpose to enforce rules on the data? myDT.Constraints.Add("PK", myDT.Columns["UniqueID"], true); //add a primary key myDT.Constrinats.Add(new UniqueConstraint(new DataColumn[] { /...

Compare dataset or a better idea

How do I compare values of one data set from another. 1st dataset["proper records"](coming from sqlserver, with column name [id],[subsNumber]), 2nd dataset["proper and inproper records"](coming from progress database, with diffrent coulums except 1 which is[subsNumber]). how do I go and make another dataset which has all the [subsNumbe...

How Can I Remove Access Db's temporary ldb file

I have an ASP.NET Project. I am connecting to the DB and then closing and disposing of the connection object. But when anyone enters my site, MS Access creates a temporary dbname.ldb. When I want to download my original mdb file from my server it won't let me access the mdb file. I can't do anything if there is ldb file in server. It's l...

.net : Are DataSet and TableAdapters agnostic of database and vendor?

Hi all, We need the application we are building to be Database-agnostic. In particular, I need it to be able work with SQL Server, Oracle and MySQL. In the future, possibly other DB Vendors will be added to the list. Of course, whatever DB is to be used will have the same schema. In order to build a prototype to demonstrate the interfa...

Adding a datarow from an existing table to a new table

Hi i want to add a datarow that im getting back from a data table to a new datatable this is the code im using: foreach (DataRow dr1 in dt.Rows) { string AptType = dr1["AppointmentType"].ToString(); if (AptType == "FreeTime") { dt2.ImportRow(dr1); } } RadGrid2.DataSource = dt2; reader.Close(); conn.Close(); the problem i...

Need help designing big database update process

We have a database with ~100K business objects in it. Each object has about 40 properties which are stored amongst 15 tables. I have to get these objects, perform some transforms on them and then write them to a different database (with the same schema.) This is ADO.Net 3.5, SQL Server 2005. We have a library method to write a single pr...

How can I make LINQ to SQL use a connection string which is being modified at runtime?

I'm experimenting some difficulties trying to use Connection String Builders (ADO.NET) within LINQ to SQL. Let me show you guys what I'm trying to do: the app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <connectionStrings> <add name="LoremIpsum" ...

What is most effective and easy way to batch INSERT query into SQL 2005/8

Hi! I'm new to ADO.NET so asking for help. I have to insert large number of records in one table. What is best-practice, effective and easy way to do that? I found an article called Batch Requests (ADO.NET Data Services Framework) but it isn't clear for me. Also I found an article about BULK INSERT but such method uses external file, I...

retrieve specific range of rows in a SQL Server table

Hello everyone, I have a table structure like (OrderID [uniqueidentifier], OrderDesciption [nvarchar]), I am using ADO.Net + C# + VSTS 2008 + SQL Server 2008. The table is big, and I want to let client give me two inputs, begin range index and end range index, and I will return specific rows of the table which is in the range (between b...

Error inserting data using SqlBulkCopy

I'm trying to batch insert data into SQL 2008 using SqlBulkCopy. Here is my table: IF OBJECT_ID(N'statement', N'U') IS NOT NULL DROP TABLE [statement] GO CREATE TABLE [statement]( [ID] INT IDENTITY(1, 1) NOT NULL, [date] DATE NOT NULL DEFAULT GETDATE(), [amount] DECIMAL(14,2) NOT NULL, CONSTRAINT [PK_statement] PRIMARY KEY CLUSTE...

Strongly Typed Datasets and CommandTimeouts

Preamble: So, over the past 5 years or so various applications and tools have been written here at my company. Unfortunately many of the people who developed these applications used strongly typed datasets, I'm considering outlawing them in our shop now... One of the larger processes that used strongly typed datasets is now timing out...