ado.net

Dataset Sometimes has no tables after Fill

We have a winforms application calling a stored procedure every few seconds. The stored procedure always returns a resultset with 0 or more rows and the client fills a dataset. Once every few days or so we are finding that the dataset has no tables in it, and we can't figure out why. The process of firing the stored procedure does hap...

DataReader hangs while mapping a record to an object

Hi all, I'm in the middle of a project where we are querying a database with more than 20 million records, applying several set of filters our query returns about 200 records (after waiting for about 1.30 minutes). After querying the database I try to create objects from this particular datareader but once every 15 or 16 records the asp...

Bizarre Oracle 11 / ADO.NET Error

I am using Oracle 11.1.0.6.0 and ADO.NET (System.Data.OracleClient) to run a query that works fine with Oracle 9 & 10 but on Oracle 11 we are getting the error: System.Data.OracleClient.OracleException was unhandled Message="ORA-01405: fetched column value is NULL\n" Source="System.Data.OracleClient" ErrorCode=-2146232008 Code=1...

What is the best c# method you've seen for encapsulating an ADO.Net query

We're building a simple ADO.Net infrastructure, and looking for the best practice for creating one or more objects/methods to handle queries to SQL Server. Such a method could for example, take a connection string and a query (or stored proc), and return a datatable, dataset, etc., with the query results. How has this worked best for...

Datagridview with ADO.Net Entity Framework: null values

Hi everyone, I have some problems with the Datagridview, a Bindingsource for the datagrid with a datasource of a ADO.net Entity Framework ObjectEntity called categorie. During runtime, and setting the BindingSource Controls property 'DataSource', I get this error message: "[ConstraintException] This property cannot be set to a null ...

Difference between Linq to Sql, Linq, Typed Datasets, ADO.NET

I been wondering about this for a while. It seems like there are so many ways now I don't know when to use what? Or if there is even a point to learn them. Like I don't know if they basically do all the same things and just basically stick with one till you master it then maybe look at other ones. So when I was taking an ASP.NET course ...

Is anyone using System.Data.SQLite within SharpDevelop?

I was just wondering if perhaps any of you guys has been successful integrating SQLite into a SharpDevelop project? If that's the case it'd be really interesting if you wouldn't mind to go ahead and share the experience with the rest of us. I've tried the more sort of orthodox approach of using Visual Studio 2008 Express Editions and wh...

What's better: DataSet or DataReader ?

I just saw this topic: http://stackoverflow.com/questions/2250/datatable-vs-dataset but it didn't solve my doubt .. Let me explain better, I was doing connection with database and needed to show the results in a GridView. (I used RecordSet when I worked with VB6 while ago and DataSet is pretty similar to it so was much easier to use Data...

ado.net entity framework using count in a where clause

Hi, I am trying to execute the following query but I get the wrong results back. foreach (var item in (from project in db.Projects where project.Id == pProjectId from task in project.Tasks from taskItem in task.TaskItems ...

Group rows on DataTable in ADO.Net - group by

I have the exact same question as this one: http://stackoverflow.com/questions/831519/aggregate-functions-in-ado-net-with-group-by-functionality/1084230 however the proposed solution was for .net 3.5 but I am using .Net 2.0 so I cant the LINQ query. To summarize: I have a DataSet and I want to create a view from it and apply something s...

Calling stored procedure via query and getting return value in C# without output parameters

Hello Is there anyway I can execute stored procedure via EXEC (so not specifying command type as StoredProcedure in C#) and get result? I tried to execute query DECLARE @R int EXEC @R = proc p1, p2 and then to grab @R but without success. What I don't want is to do it the usual way by adding parameters and using ParameterDirection...

Why is the column name from a CSV file different than its DataTable?

Howdy, I'm using an OleDbConnection, OleDbCommand, and OleDbDataReader to read a CSV file into a DataTable. The CSV file uses the first row as a header row. Some of the names in the header have non alphanumeric characters like ( _ . / ). When the system creates the Column names it is transposing the . (period) character into ...

Dealing with null dates returned from db.

Hi I am trying to return a collection which may potentially have null date values. However, if they are null - I want to keep them that way and not just use a arbitrary date instead. If it was a string, I'd check for nulls like thus: calEventDTO.occurrenceType = dr.IsDBNull(10) ? null : dr.GetString(10); How would I do the same for a...

Are ADO.net data services efficient from server side?

Hi, I'm current using Raptier as a DAL. It has served me very well up until now, but it is becoming restictive to the kind of RAD work I do, as any changes require a large number of classes to be refactored etc... In addition they don't seem to be releasing any more templates/upgrades etc... Currently I have... UI (server side ...

Is mixing ADO.NET and LINQ-TO-SQL bad? My data layer isn't working...

UPDATE As Mathias notes below, this exact problem has been reported and resolved here: ASP.NET-MVC (IIS6) Error on high traffic: Specified cast is not valid ORIGINAL POST This may be too specific a debugging issue to be posted here, but I'm posting it anyway in the hopes that it produces a solution that others find useful. I have a w...

DataAdapter.Fill() behavior for row deleted at the data source

I'm using the DataSet/DataTable/DataAdapter architecture to mediate between the database and my model objects, which have their own backing (they aren't backed by a DataRow). I've got a DataAdapter with AcceptChangesDuringFill = False, AcceptChangesDuringUpdate = False, and FillLoadOption = OverwriteChanges. Here's my understanding of th...

How to use C# to get column's description of Sql Server 2005?

I can use " Microsoft.SqlServer.Management.Smo.Table " in C# to get a table columns of a Sql Server 2005 database. I have got the column.Name, but how can I get the column's Description in C#? I have saw the link: http://stackoverflow.com/questions/887370/sql-server-extract-table-meta-data-description-fields-and-their-data-types But ...

Winforms data binding: Custom classes or datatable?

Hi guys, Am in the process of architecting a new windows forms application, and I intend to use Visual Basic 2008 and SQL Server Express 2005. This is my first application in .Net and I really want to observe the best OOD & OOP principles to create an application that is easy to maintain and extend (add new functionality). My issue is i...

how to make DataSet return two related Tables?

Hello everyone, I am using C# + .Net 3.5 + VSTS 2008 + ADO.Net + SQL Server 2008. I have two related tables in SQL Server (foreign key relationship). And I want to load the two tables as two datatables in a dataset. Any reference code to do this? thanks in advance, George ...

ADO.Net DataReader error: Already an Open DataReader

Hello everyone, I am using C# + .Net 3.5 + VSTS 2008 + ADO.Net + SQL Server 2008. And I am sharing one single SQL Connection object (TestDBConnection variable in my below sample) within my application. The exception I met with is, "There is already an open DataReader associated with this Command which must be closed first.." Any ideas ...