ado.net

Batching in ADO.NET without DataAdapters

Hello, Is it possible to implement batching of multiple stored procedure calls (doing updates/deletes) in ADO.NET without resorting to DataAdapters? ...

Typed dataset not recognized when moved to another project

Hi- I moved a typed dataset from one project to an ASP Web Application project. I put the typed dataset into one of the existing directories as it was in the App_Code directory of the previous site but don't see the option to create that asp.net folder in this project. Now, when I try to instantiate the typed dataset, the compiler says ...

How to get to Foreign keys in the ADO.NET entity model?

I have 3 tables (and corresponding entities in the entity model) Game: Id - primay key ... other columns Player: Id - primary key ... other columns GamePlayer (a player can participate in many games) GameId --> foreign key from Game PlayerId --> foreign key from Player ... other columns In my code, I have gameId and playerId available...

Import from ADO.NET Data Services into Excel

I'm playing around with ADO.NET Data Services and would like to import the output from a query into a spreadsheet. Although Excel 2007 allows me to import the results of a request from the web page, the resulting spreadsheet contains all the XML header info which makes seeing/working with the data impossible for my users. Can't seem to...

High performance product catalog in asp.net?

Hi, I am planning a high performance e-commerce project in asp.net and need help in selecting the optimal data retrieval model for the product catalog. Some details, - products in 10-20 categories- 1000-5000 products in every category - products listed with name, price, brand and image, 15-40 on every page - products needs to be listed ...

How does ADO.Net know which version of the SQL Native Client to use if you have both SQL 2005 and 2008 in your environment?

How does ADO.Net know which version of the SQL Native Client to use if you have both SQL 2005 and 2008 in your environment? ...

Can I get a reference to a pending transaction from a SqlConnection object?

Hey, Suppose someone (other than me) writes the following code and compiles it into an assembly: using (SqlConnection conn = new SqlConnection(connString)) { conn.Open(); using (var transaction = conn.BeginTransaction()) { /* Update something in the database */ /* Then call any registered OnUpdate handlers */ ...

Microsoft provider for Oracle and positional parameters

Is there a way to use positional parameters when calling Oracle stored procedure using System.Data.OracleClient? IDataParameter parameter = dbCommand.CreateParameter( ); parameter.Value = "Blah Blah"; parameter.Type = OracleType.Varchar; dbCommand.Parameters.Add(parameter); The code above creates a parameter and assigns "Parameter1"...

DataGridView, BindingSource and sorting in vb.net

I am emulating the functionality of an old app in VB.Net. I have a DataGridView on my form which is bound to a BindingSource. I have a button on the toolbar which lanuches a sort dialog. The sort dialog allows sorting by up to 3 columns. So I'm building a string from the results of the dialog and setting the BindingSource.Sort prop...

How can I check for DBNull while executing my command only once?

When I retrieve any Scalar value from the database, I usually write code like this for nullable fields. cmd.ExecuteScalar() == DBNull.Value ? 0 : (int)cmd.ExecuteScalar() But I don't like it because it executes the Executescalar statement twice. It's an extra trip to the server for my website and in favor of performance I don't want t...

SqlClient calls causing "Thread was being aborted at SNINativeMethodWrapper.SNIPacketGetConnection(IntPtr packet)"

I would really appreciate any suggestions, no matter how simple or complex, to help me get this issue isolated and resolved. I have a bit of code that generates small report files. For each file in the collection, a stored proc is executed to get the data via XML reader (its a pretty big result set). When I created all this, and steppe...

Sorting Report data in a ReportViewer using a BindingSource

I'm trying to get ReportViewer to display data from a BindingSource (VB.Net Winforms). I built the report on the underlying dataset. Then I configured the Data Source Instance to the BindingSource. I thought that would apply the sorting, filtering, etc. But it just looks like the data is coming from the dataset instead of the Bind...

Databinding to a programmaticly created DataTable

Suppose I have a datatable like this: DataTable dt = new DataTable("Woot"); dt.Columns.AddRange(new DataColumn[]{ new DataColumn("ID",typeof(System.Guid)), new DataColumn("Name",typeof(String)) }); When I try to bind a control to it: this.txtName.DataBindings.Add("Text", _d...

IDataReader and "HasColumn", Best approach?

I've seen two common approaches for checking if a column exists in an IDataReader: public bool HasColumn(IDataReader reader, string columnName) { try { reader.getOrdinal(columnName) return true; } catch { return false; } } Or: public bool HasColumn(IDataReader reader, string columnName) { reader.G...

Entity Framework query with grouping (many to many)

Hello comrades. I have a classical many to many scenario with three tables (students, courses, and third StudentsCourses assignment table). I'm using EF in my new project and EF designer doesn't create third table. I need to select all cources along with number of students assigned to it. Using plain SQL is very straightforward: selec...

How can I limit DataSet.WriteXML output to typed columns?

I'm trying to store a lightly filtered copy of a database for offline reference, using ADO.NET DataSets. There are some columns I need not to take with me. So far, it looks like my options are: Put up with the columns Get unmaintainably clever about the way I SELECT rows for the DataSet Hack at the XML output to delete the columns I'...

CSV access via ADO.NET in 64-bit?

Hi, In a 32-bit .NET app, I can use this (OLEDB) connection string to connect to a CSV file via ADO.NET: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\foo;" or this one (ODBC): "Driver={{Microsoft Text Driver (*.txt; *.csv)}};Dbq=c:\foo" However there apparently arent 64-bit versions of either the OLEDB Jet drivers or the ODBC te...

Activator.CreateInstance with private sealed class

I'm trying to new up a LocalCommand instance which is a private class of System.Data.SqlClient.SqlCommandSet. I seem to be able to grab the type information just fine: Assembly sysData = Assembly.Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); localCmdType = sysData.GetType("System.Data.SqlClient....

Exception When Using Entity Framework On GoDaddy

I am trying to use the Entity Framework in an ASP.NET application hosted at GoDaddy. I keep receiving the following error: Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change ...

AddWithValue-method (C#) does nothing

I'm currently writing a class to handle all database-activity in my application, and so I've come to the method that performs UPDATE-queries. As of now I'm returning and displaying the content of the commandtext to check it, and it seems fine: UPDATE news SET title = @title, newsContent = @newsContent, excerpt = @excerpt, date = @date,...