ado.net

Is TransactionScopeConnections in the data application block thread safe?

I have been studying the code for TransactionScopeConnections as I need to implement something similar and I am having trouble understanding the intent of the thread handling logic. In the method GetConnection transactionConnections is first locked to retrieve a list of connections and after the lock is released the list of connections i...

transaction question in SQL Server 2008

I am using SQL Server 2008 Enterprise. And using ADO.Net + C# + .Net 3.5 + ASP.Net as client to access database. When I access SQL Server 2008 tables, I always invoke stored procedure from my C# + ADO.Net code. My question is, if I do not have any transaction control (I mean begin/end transaction) from my client C# + ADO.Net code, and I...

Using Command.Prepare with a SELECT, do I need to specify the SELECT columns as output parameters?

I'm trying to use Command.Prepare with a CommandType.Text query that has a single input parameter. The SELECT has several columns that I am extracting with a DataReader. Do I need to specify each of the select columns as output parameters before calling Command.Prepare()? Even if I don't need to specify them, will performance improve ...

Accessing Google Spreadsheets with C# using ADO.Net Data Providers?

I want use Google Spreadsheets as data storage, but transparently via ADO.Net Data Provider. There is in some place an implementation? ...

How to add values to listbox ?

I have Datatable collected with my Column Names.. I want to add them in listbox.. Many column are there.. So need to use For each how can i achieve this ...

How can I programmatically check (parse) the validity of a TSQL statement?

I'm trying to make my integration tests more idempotent. One idea was to execute rollback after every test, the other idea was to some how programatically parse the text, similar to the green check box in Query Analyzer or SSMS. How do I get SQL Server to parse my command without running it using ADO.NET? UPDATE: This is what finally...

F# and ADO.NET - idiomatic F#

I'm just starting to learn F#. I wrote this F#/ADO.NET code last night. In what ways would you improve the syntax - make it feel like idiomatic F#? let cn = new OleDbConnection(cnstr) let sql = "SELECT * FROM People" let da = new OleDbDataAdapter(new OleDbCommand(sql, cn)) let ds = new DataSet() cn.Open() let i =...

Add One DataView to Another in C#

I need to add two DataViews together to have one Dataview that can then be bound to a Repeater. I am plugging into someone else's API so I can't change the way the data is retreived at the SQL Level. So essentially I want to do this: DataView dView1 = getActiveModules(); DataView dView2 = getInactiveModules(); ModuleView = dView1 + ...

TransactionScope not rolling back with SqlDataAdapter.Update

I'm using SqlDataAdapter.Update with DataTables to update two SQL tables in a single transaction. If either insert fails I want to roll back all data. This is my code: using (var conn = new SqlConnection(_connectionString)) { conn.Open(); using (var scope = new TransactionScope()) { // Insert first table usi...

Query excel spreadsheet for cell format.... (percentage)

I am using the .Net 4.0 and excel 2003 How can i use an oledb connection to retrieve the cell format of an excel spreadsheet... I specifically want to find out if a cell column (or cell itself) is in a numeric percentage format. I cannot seem to find this information in the GetOleDbSchemaTable method. EX: My web app reads numbers from...

WPF Binding ADO.Net Entity Framework to a ComboBox

Hi All I am working on a small system for a summer camp in WPF. I have a database that is linked via ADO.Net Entity Framework. It contains two tables; Campers & Bunks. The structure is as follows: Campers CustomerID, INT (Key) Name, NVARCHAR BunkID, INT Bunks BunkID, INT (Key) Name, NVARCHAR There is a foreign key relationship ...

Linq or ADO or ?

Building an application with a database that has the ability to get big not HUGE but definate big tables with a million records +. I just saw somewhere that LINQ isn't good for Big Datbases. Front end will be in Silverlight and I was really looking forward to using its Skip and Take functionality for the Asynchronous calls to speed u...

Is there a way to use the Task Parallel Library(TPL) with SQLDataReader

I like the simplicity of the Parallel.For and Parallel.ForEach extension methods in the TPL. I was wondering if there was a way to take advantage of something similar or even with the slightly more advance Tasks. Below is a typical usage for the SqlDataReader, and I was wondering if it was possible and if so how to replace the while loo...

How to extend DataRow and DataTable in C# with additional properties and methods?

Hi, I would like create a custom DataRow that will have -let's say- a propery called IsCheapest. public class RateDataRow : DataRow { protected internal RateDataRow(DataRowBuilder builder) : base(builder) { } public bool IsCheapest { get; set ;} } And I want to have a new DataTable that contains only *RateDataRow*s s...

how to form DataRelations between DataTables when there's duplicate values in columns in C#/.NET 2.0

i have a situation like this: TOWN_PLAN_UNIT table: ID NAME 123 Block123 456 Block345 BUILDING_TOWN_PLAN_UNIT table: UNIT_ID BUILDING_ID 123 999 123 908 456 333 456 999 BUILDING ID NAME 999 Building999 I want to gather all data of block456 to a tree and I use DataRelations: TOWN_PLAN_UNIT.ID -> BUILDING_TOWN_PLAN_U...

ADO.NET and ExecuteNonQuery: how to use DDL

I execute SQL scripts to change the database schema. It looks something like this: using (var command = connection.CreateCommand()) { command.CommandText = script; command.ExecuteNonQuery(); } Additionally, the commands are executed within a transaction. The scrip looks like this: Alter Table [TableName] ADD [NewColumn] bigi...

Sharing a data base in local network VisualBasic.Net

hey everyone, I have created an application using Visual Basic .NET, the application use an access data base which must be shared in server of a local network. The problem is when i run the application in a client machine (connected to the network) I can't connect to the data base.In the same machine the connection work wich it's no...

i'm lost: what is wrong with this ado.net code?

well, the question is clear i hope, the code is this: string sql = "delete from @tabelnaam"; SqlCommand sc = new SqlCommand(); sc.Connection = getConnection(); sc.CommandType = CommandType.Text; sc.CommandText = sql; SqlParameter param = new SqlParameter(); ...

When does a role get enabled for a user in Oracle 10g?

I use ADO.NET from C# 4 in order to set up a test context for a component. I execute the following SQL as sysdba: new[] { "create user \"{0}\" identified externally default tablespace USER_DATA temporary tablespace TEMP profile DEFAULT" .FormatWith( Config.QualifiedUserName ), "create role {0}" .FormatWith( Config.RoleN...

ADO.NET: Can a single SqlConnection execute more than one query at once?

How goes it everybody? Very simple question today. If I give two separate Threads two different SqlCommands. If both SqlCommands use the same SqlConnection, can they execute at the same time? Does SqlConnection block this behavior? Or does something... more interesting happen? (I do believe SqlConnections are pooled by connection strin...