ado.net

How to Pass a list as a param in .NET

Hello, I have a query that is basically like this: SELECT foo FROM bar where bar.Id in (1,2,3); I would like to pass the list of Id's in as a single param with IDbDataParameter where the query is formatted: SELECT foo FROM bar where bar.Id in (?ListOfID); and then have a single param that is a list rather than having to do some...

DataTable.Merge and DataTable.ImportRow does not change RowState

I am having issues with ADO.NET 2.0 merging/importing data. I need to update/insert data from one generic table to another table with both tables maintaining an identical schema. The following code works great locally, but does not make changes to the database: OleDbDataAdapter localDA = loadLocalData(); Ol...

How to display a DataRelation on DataGridView

Hello Im using C# 3.5 and I try to solve the "more than one entity situation" using a single query for each one and then joined them with DataRelation, so after I realized that I've tryed to show data on this way : DataColumn parentColumn = dataSet.Tables["Suppliers"].Columns["SupplierID"]; DataColumn childColumn = dataSet.Tables["Prod...

ASP.NET OleDb Excel Connection to Worksheet

I have an Excel file that the customer is pulling from their financial software and uploading to my web app. I need to connect to the file through ADO and read its contents into a SQL database. The problem is that the file that comes from the financial software is a standalone Excel Worksheet, not Workbook, so no piece of software (b...

Ado Entity Best Practice

I’m just working on this interesting thing with ADO.net entities and need your opinion. Often a solution would be created to provide a service (WCF or web service) to allow access to the DB via the entity framework, but I working on an application that runs internally and has domain access pretty much all the time. The question is if it’...

Will the Reader Gets Closed

public string GetSomething() { var a = String.Empty; try { // loop through the datareader return "some data"; } finally { reader.close(); } return whatever; } ...

How to run PerfMon on ADO.Net to find leaking connections on the DB Server?

As the title says: How to run PerfMon on ADO.Net to find leaking connections on the DB Server? ...

Is it WCF services VS ADO.NET Data Services?

Hi I only have vague idea of what WCF services are, but since most jobs for Asp.Net programmers ( those programming at Object data layer and Data access layer ) will also require you to know WCF services, I will probably need to learn WCF services also. But then there’s also ADO.NET Data Services a) Do the two technologies compete ...

ado.net entity framework massive confusion

Hi All, I really hope you can help me as I am about to just throw my MVC/Entity Framework project in the bin and start a MVC/Linq project. I am building a forum as a project just to get to know MVC/Entity, and I have 4 tables which are all related. Forum_Category, Forum, Topic, Reply so there is a 1 to many on Category_ID between F...

Can I page through grouped data in DataGridView?

I have a simple VB.NET 2008 app that helps users to edit fields in the database. Simple enough as a first "real" project in .NET, right? For one table, I am currently using a DataGridView so it can be edited straight up. However, instead of offering the user the entire table, I'd like to group the data by the 'CompanyNumber' column and ...

Missing many-to-many associations after recompile in ADO.NET Entity Framework

Hello all, I have a simple application using ADO.NET EntityFramework using a many-to-many relationship between two tables (with the use of a mapping table), let's say Books and Authors. I do have the foreign keys correctly associated between the three tables, I can add two Authors for the same Book and the data is written correctly in t...

Determine whether to generate ExecuteNonQuery or ExecuteReader from schema

I am attempting to create a stored procedure/ADO.NET mapping mechanism where a stored procedure with parameters becomes object MyStoredProcedure.Execute(out returnValue, param1, param2, ...) The problem comes when trying to generate the actual data retrieval method. I can easily obtain most of the schema information I need from the I...

How to refresh dataset and maintain row position

I have a dataset that has changes. I call the .fill(ds) method to "refresh" the dataset. The dataset is bound to a grid. How do I go to the last position I was in (in the grid) prior to the refresh? ...

How can I specify the character encoding to be used by OLEDB when querying a DBF?

Is it possible to specify which character encoding should be used by OLEDB when querying a DBF file? A possible work-around would be to encode the query string before the OLEDB call to the DBF file's character encoding and then encode all the results when they are returned. This will work but it would be nice if OLEDB or possibly ADO.N...

OleDbCommand parameters order and priority

I have been debugging this query for the last 40 minutes, and the problem apparently is the order of the parameters after all. SELECT * FROM tblSomeThing WHERE id = @id AND debut = @dtDebut AND fin = @dtFin Then I add the parameters this way, notice that the two last parameters are switched, I get no results. cmd.Parameters.Add("@id"...

Checking WCF / ADO.NET service definition

Hello, I'm quite a heavy user of WCF and ADO.NET data services. I use them a lot in links between different systems. Now sometimes I would update one side of such a link and forget another side. The other side will crash and most of the times give a pretty useless error about some type being not found or something like that. Is it pos...

SET NOCOUNT ON usage

Inspired by this question where there are differing views on SET NOCOUNT... General accepted best practice (I thought until this question) is to use SET NOCOUNT ON in triggers and stored procedures in SQL Server. We use it everywhere and a quick google shows plenty of SQL Server MVPs agreeing too. MSDN says this can break a .net SQLDat...

ADO.Net DataReader timeout issue

Hello everyone, I am using ADO.Net + C# + VSTS 2008 + ADO.Net to connect to SQL Server 2008 Enterprise. I am using almost the same pattern/sample mentioned here -- using ADO.Net DataReader to retrieve data one entry (row) by one entry (row). http://msdn.microsoft.com/en-us/library/haa3afyz.aspx My question is, if I set the SqlCommand ...

C++/CLI Managed Wrapper and ADODB::Recordset

I have a native C++ DLL that uses COM ADO Recordsets and am in need of converting it to the .NET variant (ADODB::Recordset). I have tried several approaches to tackling this problem without success. The native C++ DLL dynamically creates and populates the COM Recordset. Ideally I'd do the same for the ADODB::Recordset within the manage...

Is there an abstract ADO.NET interface that declares pagination?

I'm implementing a DAL library that is database vendor neutral. Is there an abstraction in ADO.NET (System.Data) for describing pagination? And, do some vendors' ADO.NET provider implementations support such an interface so that I don't have to manually tool up the customized SQL syntax? ...