ado.net

Can't connect to database (OCIenVCreate has failed)

I'm using an Oracle database(10g) which contains a stored procedure called Foo. Foo takes 2 datetime as IN parameters and 1 cursor as OUT parameter. I've been trying to make the connection and the query to the database with the OleDbCommand, but since Foo needs a cursor I have no choice but to use a OracleCommand(right?). When I try t...

Entity Framework (Entities Classes) Serialization

Hi , After reading about Enitity Framework , i have some questions: 1] What is the best way to transfer Entities between tiers ? a] do i must create lighter DTOs for this or i can Effectively serialize the Entitiy and transfer it ? b] if i must create light DTOs,for Efficency, and after i saw the nice usage of Automapper ...

C# and PostgreSQL

Can any one show me working example of using cursor returned from PLSQL to c# code? I found many examples showing how to fill dataSet with returned data but I cannot find how to use that cursor with DataReader, as a result I have {unnamed portal}. NpgsqlTransaction tr = (NpgsqlTransaction) Connection.BeginTransaction(); NpgsqlCommand cu...

Prevent ADO.NET from using sp_execute

In our SQL Server 2005 database (tested using Management Studio with DBCC FREEPROCCACHE and DBCC DROPCLEANBUFFERS), the following statement is fast (~0.2s compile time, ~0.1s execution time): SELECT ... FROM ... WHERE a = 1 AND b = '' ... The following statement, however, is slow (~0.2s compile time, 7-11s execution time): exec sp_e...

Excel through OleDb shows numbers differently...depending on whether spreadsheet is open!?

I'm opening an Excel worksheet into a DataTable using OleDb like this: string select = string.Format("SELECT * FROM [{0}$]", worksheetName); using (var con = new OleDbConnection(connectionString)) using (var adapter = new OleDbDataAdapter(select, con)) { con.Open(); var dt = new DataTable(); adapter.Fill(dt); con.Close()...

Dataset / Datatable question - how do I ensure I see updates to my DataTable in real time across parts of my code?

Hi, I'm setting up a Dataset and DataTable in one section of my code. I'm having trouble understanding why update data in one area of my code why I don't see this in another area. I'm doing my best to use the same DataTable as far as I can tell (see code below). What is the minimum I have to do if I want to see new rows that I add in...

Get table name from ADO.NET Field?

If i do a select on user.name, user.post, t.name with t being tag_name AS t is there a way to resolve the full name using ADO.NET? I found SqlDataReader.GetName but that is getting me only name as the first result. I would like to know if it belongs to user or tag_name. Is there a way to have it tell me? ...

Sqlite setting the default value in create table

I wrote something like create table if not exists QuickTest ( id integer primary key NOT NULL, a TEXT DEFAULT @0, b TEXT, c TEXT); I get an error on @0. Is there a way to insert parameters here or do i need to hardcode the value in? I typically like using parameters when setting values. ...

how to display few records from a database in dataviewgrid control in c#?

suppose i am having a database table with 20 records and of that i want to display only 10 records in the dataviewgrid control, how can i achieve this? ...

Using ADO.net Entity Framework 4 with Enumerations? How do I do it ?

Question 1: I am playing around with EF4 and I have a model class like : public class Candidate { public int Id {get;set;} public string FullName {get;set;} public Gender Sex {get;set;} public EducationLevel HighestDegreeType {get;set;} } Here Gender and EducationLevel are Enums like: public enum Gender {Male,Female,Undisclosed} pub...

Is there a .NET Polymorphic Data Framework

I'm beginning work on a new project that's would be much easier if there was some way to make different data models polymorphic. I'm looking at using the Entity Framework 4.0 (when it's released), but have been unable to determine if it will actually be able to work. Here's the basic scenario. I'm implemented a comment system, and wou...

VS2008 DataSet Wizard doesn't match tables for updating

Hi all, first question ever on this site. I've been having a real stubborn problem using Visual Studio 2008 and I'm hoping someone has figured this out before. I have 2 libraries and 1 project that use strongly typed datasets (MSSQL backend) that I generated using the "Configure DataSet with Wizard" option on in Data Sources. I've had...

wait for transactional replication in ADO.NET or TSQL

My web app uses ADO.NET against SQL Server 2008. Database writes happen against a primary (publisher) database, but reads are load balanced across the primary and a secondary (subscriber) database. We use SQL Server's built-in transactional replication to keep the secondary up-to-date. Most of the time, the couple of seconds of latency i...

default parameters and compile time constants

Why is SqlInt32.Null not considered a compile-time constant? Because I cant use it as the default value of a default parameter. ...

Database Connectivity ASP.NET - PostgreSQL

Am trying to run a C# application which fetches data from PostgreSQL database(8.4) and am using the PostgreSQL OLE DB Provider This is my connection string string connString = @"Provider=PostgreSQL OLE DB Provider;Data Source=localhost;location=;User ID=;password=;timeout=1000"; The error am getting is The 'PostgreSQL...

Do we have transactions in MS-Access?

I am developing a small desktop application using C#.NET and MS-Access. I don't have any prior experience of MS-Access. I want to know if we can use transactions in Ms-Access or not. I have the below mentioned situation. Insert in Tbl1 Insert in Tbl2 I want to insert in tbl2 only when insertion in tbl1 is successful. And if there ...

Avoid boxing in DbParameter.Value?

Hi I'm using ADO.NET to communicate some db, and searching for a way to avoid boxing when setting the DbParameter.Value property to value-type. Is there a way to avoid boxing in DbParameter.Value? Thanks. ...

How do i convert this linq code to inline sql

How would I covert this query to inline sql or a stored procedure? var a = from arow in context.post where arow.post_id == id && arow.post_isdeleted == false select new { arow.post_id, PostComments = from c in context.comment where c.CommentPostID == arow.post_id select new ...

How to map EntitySql function to a differently named function in the store?

The question is: Given a database backend that understands LeftStr and RightStr: where, in a custom ADO.NET provider implementation, would I establish a mapping to the immutable EDM canonical functions Left and Right? So I am working with the SQLite ADO.NET provider and it works, more or less, until you bump up against some string fun...

ado.net dirty records in dataset

Hello, I'll try to explain. I want to track dirty records in my dataset row that is bound to controls on window (wpf). It works fine. Lets say i begin to edit some textbox that is bound to dataTable in that dataSet. After i add one character to textbox, dataset is marked dirty. But if I delete that character again ( restore original va...