ado.net

Parameterize 'order by' in SQL

What's the proper way of parameterizing an order by clause in ADO.NET ? Sometimes there's a need to order by 2 columns, while the default is ordering on just 1 column, and sometimes you'll just want to change ASC to DEC. Is it considered ok to just use string concatenating in such cases (provided the input doesn't come from the user di...

Is there a way to create an ADO.NET connection and ignore the ambient Transaction?

I have a situation where I am running in a WCF service that has TransactionScopeRequired=true, which means there will always be an ambient transaction. However, I need to start a new connection that will be around for the lifetime of the application, which means I can't have it use the abmbient transaction. Any ideas on how to do this?...

SQL SELECT Arrays in C#?

Possible Duplicate: Is it possible to send a collection of IDs as a ADO.NET SQL parameter? Duplicate: this is a duplicate of Is it possible to send a collection of ID’s as a ADO.NET SQL parameter? and many others. Please vote to close it and add any additional answers to one of the other duplicates. Given an array of parameters...

Should I read a book on specifically SQL Server, ADO, ADO.NET or ADO.NET Entities to learn to persist data for an ASP.NET MVC app?

I know the basics of mySQL and database normalization. I am getting into Microsoft programming now and plan to do a large website using ASP.NET MVC. The level of complexity of the website is probably similar to StackOverflow and other database-intensive websites. Except mine won't expect so many visitors of course :) I hear Entities is...

How to use ADO.NET DbProviderFactory with MySQL?

How to use ADO.NET DbProviderFactory with MySQL? ...

C# - Generic CRUD operation

How to achieve generic Save and Update operation using generics and reflection in C#? I have achieved data retrieve using some reference from here... I don't have much time to learn technologies like NHibernate/LINQ/Entity Frameowrk, etc. for this moment. I need a quick solution for this problem for some reason. ...

Entity Framework Delete Object Problem

hi, i am getting "The object cannot be deleted because it was not found in the ObjectStateManager". while Deleting object. here is codes ; //first i am filling listview control. private void Form1_Load(object sender, EventArgs e) { FirebirdEntity asa = new FirebirdEntity(); ObjectQuery<NEW_TABLE> sorgu = asa.NEW_T...

ADO.NET Entity Association problem

hi , i got Two Table named Personel and Departmant.. Personel Table ; PERSONELID int , PK not null NAME varchar SURNAME varchar DepartmanID integer Departman Table ; DepartmanID int , PK not null DEPARTMANNAME varchar (ONE TO MANY Relation) i wanna association between this tables. but i cant do it. with EDMX Model Designer .. gett...

A good way to access stored procedure on SQL Server 2008 from C#

I am trying to access stored procedures from my ASP.NET / C# web-application. Is there a particularly good way to do so (also a good way to pass parameters to it)? I followed following steps and absolutely don't like the approach, as you enter the procedure as a string (un-debugable): http://www.c-sharpcorner.com/UploadFile/dclark/InsO...

Any decent ADO.NET Helper utils out there?

Hi all, I am looking for some decent ADO.NET helper utility class to allow me to query an ado.net datasource. I am not looking for anything too fancy, but it has to support transactions. Is there anything out there? P.S. I know the data access block will do that but I was looking for something a bit more independent to other components...

How do you debug problems with local storage? Trouble with "An error occurred while processing this request" in HandleBatchResponse

Cross-posted at MSDN. I have a list of entity objects I'm trying to insert into a table in the local storage service. Using a data context class derived from the SampleClient TableStorageDataContext class, I create a new context object and add the entities with no issues. When I call context.SaveChanges(), an exception is ultimately t...

Undoing All Changes Since BindingSource's last EndEdit call

Here's the scenario (which uses a BindingSource bound to a DataTable within a DataSet): A user creates a new address book contact, fills in the First and Last name in data-bound controls. He presses Apply, whose event handler calls BindingSource.EndEdit(). He then realizes there was a mistake, and adds an email address. But when he pre...

Create table from existing DataTable/Dataset data with ADO.net ?

I need to create two tables. The first one I can get via database with a command. No sweat. The second one is built from the first one with nested SELECT statements, JOINs, and operators like SUM, AVG etc. So it needs more functionality than filtering and sorting. It is done in C# with .NET 2.0, so no advanced features available. Ess...

Creating Enums from Entities

I have tables named Events and Log. The Events table comprises of ID, Event description and type. And, the Log contains LogID, EventID(refers to ID from Event table), and timstamp. I am using Entities framework. While making an entry in the log table, i mention the event id as the number corresponding to the log event from the Event ta...

ADO Entity hierarchical self referencing

Hi, I have a self referencing table named categories that has a parentcategoryid column that is nullable. When I added the table to the entity designer it created two navigation properties for this relationship and I named one ParentCategory (the zero or 1 nav prop) and the other I named SubCategories (the * many nav prop). Everything...

C# string duplication issue

Hello everyone, I am using VSTS 2008 + C# + .Net 3.0. I have two input strings, I think they are different. But the following C# code thinks they are the same, and throws System.Data.ConstraintException, says Column Name is contrained to be unique, but value already exists. Any ideas what is wrong? Here is my code and my input strings,...

Load only once the tables when you update their views in VS2005

I'm using two tables from a MySQL db (let's call them db1, db2) and I have to display different views for them that are linked with each other with nested relations (using VS2005 + ADO.NET Connector). What I have been doing till now was adding new table adapters for each different view, many of which contain a lot of IF statement and gen...

Maintain DataRowState in ADO.NET Dataset - RejectChanges() method does not work?

The problem simplified: I have a DataSet with some datatables... I have a Winforms DataGrid bound to one of the datatables. User sticks some rows into said datatable, via the DataGrid, let's say 3 rows; All three rows now have their RowState = DataRowState.Added. I now begin a sqlserver transaction. Then call dataAdapter1.Update(dat...

Entity Framework and Temporary Objects

Hello, I'm new to the Entity Framework and am currently experimenting with it. I created a simple database, set up the model in VS2008, and have got the code going to query the database using the EF as well as inserting new data. There's one thing that has me a little confused though. I have an entity (set up in my model) called Custom...

TSQL and ADO - I get interview questions on TSQL, but none on ADO, is this normal?

I've been to on a few interviews for middle tier roles. I've gotten a lot of questions about TSQL, indexing, database fundamentals, but not a single question on ADO. Is this a normal experience or is there a reason for this? ...