ado.net

Cannot resolve SQL Server CE provider factory by invariant name

This line of code DbProviderFactory factory = DbProviderFactories.GetFactory("Microsoft.SqlServerCe.Client"); throws this exception System.Configuration.ConfigurationErrorsException: Failed to find or load the registered .Net Framework Data Provider. Although my machine.config file contains the following section <system.dat...

How do I compare two datasets for equality

I have two datasets each with one data table pulled from different sources and I need to know if there are any differences in the data contained in the data tables. I'm trying to avoid looping and comparing each individual record or column, although there may be no other way. All I need to know is if there is a difference in the data, ...

Aggregate functions in ADO.NET with GROUP BY functionality

This is a more direct question stemming from an earlier more general question i had earlier now that I've spend more time looking into ADO.NET I want to take an ADO.NET DataTable and perform the equivalent of a SQL SELECT query with aggregate functions (such as SUM) on some columns, and GROUP BY set for the remaining columns. I then wan...

Why does this OdbcConnection throw me a System.InvalidOperationException?

Hi community, I am building a Winforms C# 2.0 application. I have successfully been able to connect to my SLQ Server database using the following: m_connexion = new SqlConnection("server=192.168.xxx.xxx;uid=...;pwd=...;database=..."); Because my company wanted to be able to use any database, I went on to use the Odbc driver and my com...

ADO.NET calling T-SQL Stored Procedure causes a SqlTimeoutException

I have a T-SQL stored procedure with the signature CREATE PROCEDURE MyProc @recordCount INT OUTPUT @param1 INT ... When executed directly in Sql Server the procedure runs in under 5 seconds, returning a few result sets amounting to about 100 rows in total. Calling this procedure using the ADO.NET SqlDataAdapter.Fill method to populat...

transaction scope attribute in VB.NET

Hi, I need to ensure 2 calls are enlisted in a transaction Sub InsertOrder(order) ...insert order header SQL ....insert order items SQL (LOOP) End Sub I am aware I can accomplish this via a transaction scope, however, isn't there a "Attribute" available for this? Transaction.Scope()>_ Public Sub InsertOrder(order) End Sub ...

DataRelation Insert and ForeignKey

Guys, I have a winforms application with two DataGridViews displaying a master-detail relationship from my Person and Address tables. Person table has a PersonID field that is auto-incrementing primary key. Address has a PersonID field that is the FK. I fill my DataTables with DataAdapter and set Person.PersonID column's AutoIncrement...

What is the best method in passing a large number of parameters in SQL Server

I'm trying to work out what the best method to passing a large number of parameters into a stored procedure. Some methods i was thinking about are; Create the relevant database objects, including a parameter object for each item and invoke the command object Pass in an XML document and have the stored procedure unpack it. (The app wil...

Does ADO.NET TableAdapters cache stored procedure names in a super secret location

I'm guessing Visual Studio is bugging out on me. I changed the stored procedure the a TableAdapter query uses and now the users keep getting the following error. Procedure or function 'usp_GetEventNotificationSubscribers' expects parameter '@FacilityCode', which was not supplied. Nowhere in the application is 'usp_GetEventNotificationS...

How can I Fill a Dataset with data from an IQueryable?

Hi, Is there any quick way to create a table in a dataset and fill it with the schema from an IQueryable (Data is not coming from EF or Linq2Sql)? I need this for binding a grid to my data. Thanks, Roy ...

ASP.NET Database Error Trapping

I am curious as to how people trap certain database errors in .NET, particulary foreign key or unique index violations. Coming from a Classic ASP/VB background, my first inclination is to test the error number to then create a friendly message to the user that something is wrong. However, I would think that in the .NET world, there wou...

Is there a way to use a generic DbCommand to do an Asynchronous update?

When using a generic DbCommand to perform an update, it will hang indefinately if the row being updated is locked. The underlying connection used is is Devart's Oracle provider, Devart.Data.Oracle.OracleConnection Setting the DbCommand.CommandTimeOut has no effect at all, the update never times out. DbCommand does not implement BeginE...

Creating Models in ASP.NET MVC

I'm just starting a project in ASP.Net MVC with LINQ to Entities and I was wondering if there was a nice, clean way of defining models that creates the appropriate tables in the database for me. I'm most familiar with Django (in terms of MVC frameworks) and am looking for the .Net equivalent of models.py so I can have everything versione...

ADO .NET Entity Data Model: Creating a function

I have search through the web to figure this out but no luck. I have a Stored Procedure that accepts 10 fields and 3 of them are type OUTPUT so i can return values. I used Function Import to create the function and i put the return type as none. But i can't figure out how to access the function. if I put the return type an entity that i...

ADO.Net Insert strongly-typed Row without loading dataset to memory

Is there a way to insert a row using ADO.Net without filling the dataset or specifying the columns? My datasets may be large, so I don't want to load them just to add a row. I know I can insert using an adapter and specifying the columns, but I'll need to do this for many tables so I don't want to create custom code for handling each d...

Connecting from .Net in SQL Server 2005 (Winforms)

I'm diong a typical Windows Integrated Connection from a .Net Winforms Application: Dim sqlConnetion As New SqlConnection("Server=jupiter;Database=io;Integrated Security=True;") sqlConnetion.Open() I keep getting the following error: Cannot open database "io" requested by the login. The login failed. Login failed for user 'MARS\viking...

What is the best practice for implementing a data table with many inserts, deletes and reads?

I am creating a functionality where our wcf services logs all changes that are stored thru them and the changes need to be sent to other systems. After every service call with changes we store the changes in a table (the changes is serialized). Regulary we have biztalk to pull the changes from the table and delete the one that is pulled...

Asynchronous procedure call with DB2 .NET Data Provider

Is there any way to asychronously call a DB2 stored procedure using DB2 .NET Data Provider? ...

Displaying only selected headers in DataGridView

Hi! How can I display only selected headers in DataGridView control? For example I have DataTable with headers ("Name","Age","Status"), but I'd like to omit "Age" column when displaying. Thanks! :) ...

ADO.Net Excel, Checking if a table exists?

I'm using ADO.Net to work with an Excel Document. Essentially, I'm looking up values in a table called "source" and creating a new table called "result" which will be populated with the results of my query. I have a couple of questions.. A) How can I check if a table exists and create a new one if it doesn't? B) Is a table the same ...