ado.net

datalist itemdatabound event having issues changing item bg color on condition

Hey guys I'm trying to do something really simple.. I'm checking a data column in my datarow if it's > 0 I want the item back color in the datalist to be green if its < 0 remain transparent... if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = (DataRowVie...

How do i enable nested transactions

I have a similar question of how to check if you are in a transaction. Instead of checking how do i allow nested transactions? I am using Microsoft SQL File Database with ADO.NET. I seen examples using tsql and examples starting transactions using begin and using transaction names. When calling connection.BeginTransaction i call another...

Obtain stored procedure metadata for a procedure within an Oracle package using ADO.NET

Hi, I am trying to obtain the stored procedure metadata (procedure name,parameter types,parameter names etc) for a procedure declared within an Oracle package, using the standard ADO.NET API - DbConnection.GetSchema call. I am using the ODP driver. I see that the Package is listed in the 'Packages' and 'PackageBodies' metadata collecti...

How can I read a DBF file with incorrectly defined column data types using ADO.NET?

I have a several DBF files generated by a third party that I need to be able to query. I am having trouble because all of the column types have been defined as characters, but the data within some of these fields actually contain binary data. If I try to read these fields using an OleDbDataReader as anything other than a string or chara...

How to update a record without selecting that record again in ADO.NET Entity Framework?

Hi all I am doing something like this - void update(ClasstoUpdate obj)//obj is already having values to update... { var data= (from i in Entityobject.ClasstoUpdate where obj.Id==i.Id select i).FirstorDefault(); data.Name="SomeCoolName"; EntityObject.SaveChanges(); } I want to perform an update without a...

NHibernate custom connection string configuration

I have a c# library project, that i configured using nhibernate, and I like people to be able to import this project and use the project. This project has FrontController that does all the work. I have a connection string in hibernate config file and in app.config file of another project. it would be nice for anyone to be able to set t...

Fastest method for SQL Server inserts, updates, selects

I use SPs and this isn't an SP vs code-behind "Build your SQL command" question. I'm looking for a high-throughput method for a backend app that handles many small transactions. I use SQLDataReader for most of the returns since forward only works in most cases for me. I've seen it done many ways, and used most of them myself. Methods ...

C# - Inserting multiple rows using a stored procedure

I have a list of objects, this list contains about 4 million objects. there is a stored proc that takes objects attributes as params , make some lookups and insert them into tables. what s the most efficient way to insert this 4 million objects to db? How i do : -- connect to sql - SQLConnection ... foreach(var item in listofobjects)...

Reattaching an object graph to an EntityContext: "cannot track multiple objects with the same key"

Can EF really be this bad? Maybe... Let's say I have a fully loaded, disconnected object graph that looks like this: myReport = {Report} {ReportEdit {User: "JohnDoe"}} {ReportEdit {User: "JohnDoe"}} Basically a report with 2 edits that were done by the same user. And then I do this: EntityContext.Attach(myReport); InvalidOpera...

How to capture SQL with parameters substituted in? (.NET, SqlCommand)

Hello, If there an easy way to get a completed SQL statement back after parameter substitution? I.e., I want to keep a logfile of all the SQL this program runs. Or if I want to do this, will I just want to get rid of Parameters, and do the whole query the old school way, in one big string? Simple Example: I want to capture the outp...

ADO.NET Multiple simultaneous reads from an open database.

Answer not needed - my logic was wrong and this question is invalid. Charles helped me see where I went off-tracks. Thanks I have a utility that moves data from one source to another. In the process of writing the record I check to see if it exists and do an update/insert as necessary. The difficulty I have is that as I'm writing th...

ADO.NET DataTable/DataRow Thread Safety

Introduction A user reported to me this morning that he was having an issue with inconsistent results (namely, column values sometimes coming out null when they should not be) of some parallel execution code that we provide as part of an internal framework. This code has worked fine in the past and has not been tampered with lately, bu...

Integrated Windows authentication in IIS causing ADO.NET failure

We have a .NET 3.5 Web Service (not WCF) running under IIS. It must use identity impersonate="true" and Integrated Windows authentication in order to authenticate to third-party software. In addition, it connects to a SQL Server database using ADO.NET and SQL Server Authentication (specifying a fixed User ID and Password in the connectio...

Why do SQL connection leave parameters in?

While coding with sqlite everytime i always had the exact number of parameters and when i executed the query i always had 0 parameters after it. I kept using the cmd object and it worked fine. Now while porting to use sql server (2008) my SqlConnection has parameters left over from a successful command. Why? I seem to be able to create ...

How to make a Stored Procedure that takes in XML and uses that xml as an Update + call this stored procedure with ado.net?

Hi I am using ms sql server 2005 and I want to do a mass update. I am thinking that I might be able to do it with sending an xml document to a stored procedure. So I seen many examples on how to do it for insert CREATE PROCEDURE [dbo].[spTEST_InsertXMLTEST_TEST](@UpdatedProdData XML) AS INSERT INTO dbo.UserTable(CreateDate)...

Performance Related features for migration from .net 2003 Framework 1.1 to .net 2008 framework 3.5?

I am work on VB.net 2003 Framework 1.1 for last 3.5 years in windows Application. We are currently migrating to VB.net 2008 framework 3.5, but i don't know about the features which related to ADO.net and which is important to performance. I know linq to SQL but our architecture is made in .net 2003 so we should follow this. Any features...

.Net best approach SQL Server 2008 incremental update based on up to date version

Assuming daily certain up to date database is produced via loading from various sources. Changes need to be applied to historical database based on uid, new records will added , non existing will be softly deleted , some will be updated. Is Ado.Net and Sql statements the most appropriate technology for the task like this ? ...

make select @@IDENTITY; a long?

I am grabbing the last rowid and i am doing this select @@IDENTITY pk = (long)cmd.ExecuteScalar(); I get an invalid typecast bc this is int instead of long. Why doesnt this return a long? can i make it return long? Solution for now is to use pk = Convert.ToInt64(cmd.ExecuteScalar()); ...

Under what circumstances is an SqlConnection automatically enlisted in an ambient TransactionScope Transaction?

What does it mean for an SqlConnection to be "enlisted" in a transaction? Does it simply mean that commands I execute on the connection will participate in the transaction? If so, under what circumstances is an SqlConnection automatically enlisted in an ambient TransactionScope Transaction? See questions in code comments. My guess to...

How can I have 2 ADO access methods use the same Transaction?

I'm writing a test to see if my LINQ to Entity statement works.. I'll be using this for others if I can get this concept going.. my intention here is to INSERT a record with ADO, then verify it can be queried with LINQ, and then ROLLBACK the whole thing at the end. I'm using ADO to insert because I don't want to use the object or the e...