ado.net

Using the SQL Command object, how can you check to see if the result set is empty?

Using the ExecuteScalar method in the SQL Command object, how can you check to see if the result set is empty? I am using ASP.net, C#, and MS SQL 2008. Right now when I run the following code the Response.Write returns a 0 when the resultset is empty. But I would like to differentiate between 0 and empty resultsets because there are a...

TransactionScope and Isolation Level

Hello, we have a problem to use TransactionScope. TransactionScope get to us very good flexibility to use transactions across our Data Access Layer. On this way we can use transactions implicit or explicit. There are some performance boost again ADO.NET transactions, but at this time this is not really problem. However we have problem ...

Which is faster for multiple SQL calls - parameterized queries or stored procedures?

I'm using SQL Server 2005. I'm looking at opening a SQL connection, looping though a collection and running an update query (stored procedure or parameterized query) with the data from the collection item, then closing the connection. Which is going to give me better performance and why? ...

how do i use a ado.net dataservice to check if a row exists?

var svc = new LocationDataServiceContext(); var q = from c in svc.LocationTable where c.ID == int.Parse(location.ID) select c; if (q.ToArray().Length == 0) id there a neater way to do this? ...

SQL Server Transactions

When to use ado.net and SQL Server transactions? Are there any reasons why one would choose to use ado.net transactions over SQL Server transactions when there is only one SP or query fired against the database within that transactions. ...

What is the difference between a Provider and a Connector in database world?

I create an new text file, rename it to test.udl and double click on the file. This brings up the OLE DB connection string dialog box. The first tab shows a list of providers installed on my machine. I need a MySQL Connection string, but I do not have a MySql provider in the list. So I download MySql ADO.NET Connector from the internet a...

return multiple result sets from ms access to ado.net

hey guys i want to fetch 3 tables in 1 single ado.net call from my ms access database, however i get an error when i am trying to do that when i change my sql query to just fetch 1 table, my code works fine can anyone let me know how to achieve this with ms access? because i have been doing this with sql server since ages without any p...

Entity Framework Exception: Index was outside of the bounds of the array."

OK, I am having and issue with Entity Framework. I have had it working, but have now added several more entities to the model, and now I am getting the above error. For debugging purposes, I have created a test form with a grid control to populate from my Projects entity collection. FYI, I am using GUID's for my primary keys. I only have...

Storing DataRelation in xml?

Hi, I am designing a db application using a novel approach. (atleast novel to me... :) ) So I am doing some research for the same. I am using .NET 3.5 ADO.NET Datasets to work with data and store it offline in XML. First, is this approach any good for a serious (though a small db, 4-5 users, ~25 tables ~3-4k records in each) applicat...

Datasets and XML in place of proper db: Not a good idea?

In continuation of: http://stackoverflow.com/questions/729634/storing-datarelation-in-xml Thanks to everybody for answers to my earlier thread. However, could I ask the reason why everybody is not supporting this XML based approach? What exactly will be the problems? I can apply connstraints to dataset, and I can, I guess, also use tran...

Best .NET3.5 based strategy for creating disconnected db application.

Hi group: My requirements are: Relatively small database: 25-30 tables with 4-5k rows in each. 4-5 users with their own copies of local database on their laptops. Sync when needed or at the end of the day. Free solution, as am making this setup for a NFP ogranization. I have been researching various options in last few days. At last I ...

getting the MSSQL Schema for a table

I have the following C#.Net code that I am trying to get to return the stored procedure results along with the schema of those results. Below is how my code (simplified) currently looks... Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("MyStoredProcedure"); IDataReader drData = db.ExecuteRe...

Web Services, ADO.NET Connection Pool, Timeout Error

If I have an .asmx Web Service that only exposes one call. One that takes a few params and inserts those values as a record in SQL Server 2005 table. What should that method look like to be as "kind" to the ADO.NET Connection Pool as possible? What should it look like if its going to be called maybe 10 times a second (spread out) over m...

If Sql Server returns an error, then SqlException should be thrown. But it isn't

Hello, If I bind GridView to SqlDataSource and also set AutoGenerateEditButton to true, and if I then try to update a field ( this field being a primary key in database ), then database should return an error and thus SqlException should be thrown?! So why doesn’t page report an exception? Instead, all Gridview does is setting all ...

Asp.net, Linq Error: 'int' is a 'type' but is used like a 'variable'

hi everyone i am using asp.net and link to display a set of books from the db. n it gives me an error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0118: 'int'...

Convert existing LinqToSQL code to be compatible with other databases

I have a working application that communicates with an SQL Server database. This application makes use of LinqToSQL. For a number of reasons, I want to convert this application to using Microsoft Access instead. (It's a small set of data, concurrent usage is possible but rare, I want to deploy on machines that don't have access to SQL ...

adapter.update

i make the adapter.insert and the adapter.delete and both work good but not with the adapter.delete even i put only on argument here the code Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click usersAdp.Fill(userstable) usersAdp.Update(txtid.Text, Me.txtname.Text, Me.txt...

DataSets based .NET programme: Use Designer tools or do it self?

Hi, After thinking for long, I have decided to build my data app for the Not-for-profit organization I work for (I don't program regularly there, though...) using C#, .NET 3.5 (using ADO.NET DataSets) and Scimore db. I have done base basic tinkering till now and have found this combo to be quite good and fast. Ya, "fast" is a requireme...

Ado.Net Entity : Object doesn't display linked members (foreign keys)

I have a simple databasescheme: User, Account. User has 1-to-many relationship with Account. I have generated a ado.net entity data model, and I can create users and accounts, and even link them together. In the database the account.user_id is correctly filled, so theoretically I should be able to acces User.Account.ToList() in C# throu...

DataGridView bound to DataTable. Getting comboboxes for enums.

If you have a DataTable that has a column of some Enum type. And you bind a DataGridView to this DataTable (myDgv.DataSource = myDataTable).. How can you make the DataGridView show a combobox (or is it drop-down-list? The one where the only thing you can do is select) in each cell of for this column? The combobox should have the curren...