ado.net

How to access Parents Child in DataColumn Expression

I've a DataSet with 3 DataTables: dtPerson dtSalary dtFriend Every person has salaries, and every person has one friend. I've added a column dcHisFriend into dtSalary and would like to display friend name of a person owning specified salary. So dtPerson has a column NAME, dtSalary has column VALUE and dtFriend has a c...

Detecting changes to a bound datatable after validation

Here is the scenario: I have a winform with bound controls to a datatable populated by a db proc call. The user makes changes to the data in the form control. They click a "save" button on that form. I want to be able to detect that the data actually changed and call a proc if true. I want to do this with ADO.net, not a homegrown dir...

Why can’t I use a SqlConnection instance until the SqlDataReader is closed?

Hi, From MSDN: While the SqlDataReader is being used, the associated SqlConnection is busy serving the SqlDataReader, and no other operations can be performed on the SqlConnection other than closing it. This is the case until the Close method of the SqlDataReader is called. For example, you cannot retrieve output parameters until af...

What are the advantages of LINQ to SQL?

I've just started using LINQ to SQL on a mid-sized project, and would like to increase my understanding of what advantages L2S offers. One disadvantage I see is that it adds another layer of code, and my understanding is that it has slower performance than using stored procedures and ADO.Net. It also seems that debugging could be a cha...

ADO.NET Best Practices for Connection and DataAdaptor Object Scope

Hello Everyone, This is my first post on StackOverflow, so please be gentle... I have some questions regarding object scope for ADO.NET. When I connect to a database, I typically use code like this: OleDbConnection conn = new OleDbConnection("my_connection_string"); conn.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT...

ADO.net principles in java

I'm asking on opinion about implementing framework that emulates ado.net in java (data tables, data sets etc). Idea is to avoid writing domain objects since they are, so far, just used to transport data from server to client and back, with no particular business methods inside them. Main goal is to speed up development time. Could i bene...

ADO.NET Entity Framework i cant see Foreign Key Property in Model

Hi i have got 2 table.In first table i got a Foreign Key link to second table's primary key. (second)Personel and (first)Istbl are my tables. In personel table i got PersonelID , PersonelName,PersonelSurname. In Istbl table i got IsID,PersonelID,xx,xx,xx, going like this. I cant see PersonelID in EF Model Viewer also i cant see it i...

What SqlDbType maps to varChar(max)?

What SqlDbType maps to varChar(max)? SqlDbType.VarChar says that it is limited to 8K, though that may be a documentation error. ...

ADO.net best Practices

Can any one guide me,the best practices for ado.Net both for webappliaction and windows application. If possible suggest me a best book to learn ...

How can you Join multiple tables in a DataSet C#

I've converted an xml document into a DataSet with DataTables containing relational infomation. I need to merge the tables into a single table exploiting the relational information is there a way to Do SQL like queries on a Dataset to get a dataTable which can be subsequently used to populate a datagrid? ...

SQL Select where values in List<string>

Is there a way that I can create query against a data source (could be sql, oracle or access) that has a where clause that points to an ArrayList or List? example: Select * from Table where RecordID in (RecordIDList) I've seen some ways to do it with Linq, but I'd rather not resort to it if it's avoidable. ...

ADO.net without writing SQL (esp. WHERE)

I have this idea that using SQL VIEWS to abstract simple database computations (such as a count on a relation) is sufficient, and you don't need procedures (== procedural code) A simple sql view + a where clause >> a stored procedure with parameters sometimes While making this point I imagined a way of retrieving table/view data withou...

Passing sql statements as strings to mssql with C#?

This is a really, really stupid question but I am so accustomed to using linq / other methods for connecting and querying a database that I never stopped to learn how to do it from the ground up. Question: How do I establish a manual connection to a database and pass it a string param in C#? (yes, I know.. pure ignorance). Thanks ...

Benefits of using sqlclient data provider with sql server 2005 over oledb data provider

hi all, Recently I think of shifting from oledb data provider to sqlclient as I am using sql server 2005 express edition as my app's backend which contain millions of records.. Can anybody give me concrete reasons for the same please reply sooon ...

datatable merge - need to kill notifications

I am merging a datable containing 5000 rows to another table. The main table has listchanged event implemented so as of now it gets notification events triggered 5000 times. We wanted to kill that so we added Merge operation between beginloadata and endloaddata but all it does it, it delays the 5000 events till the time we make endloadda...

Composite Foreign keys with MS Entity Framework

Hi, I'm trying to create an entity model that involves two tables related. The issue that i'm getting into is that they are related using a composite foreign key. When the model is created, I can't find the relation between both entities. I tryied to create it by hand, but got to the next error: Error 111:The properties referenced ...

Problem with batch update using DataAdapter

I am updating the sql server 2005 database using batch update, as shown below cmd = new SqlCommand("update Table1 set column1 = @column1 where EmpNo = @EmpNo", con); cmd.Parameters.Add(new SqlParameter("@column1", SqlDbType.VarChar)); cmd.Parameters["@column1"].SourceVersion = DataRowVersion.Current; ...

Opening the database connection once or on every databaseaction?

Im currently creating a webportal with ASP.NET which relies heavily on database usage. Basically, every (well almost every :P ) GET query from any user will result in a query to the database from the webserver. Now, I'm really new at this, and I'm very concerned about performance. Due to my lack of experience in this area, I don't reall...

Connection string for Informix for .NET

We are using an Informix database, and are connecting to it from .NET sucessfully using ODBC. The connection string we are using is; DRIVER={IBM INFORMIX ODBC RIVER}; UID=username; PWD=password; DATABASE=our_database; HOST=devsrv01; SERVER=devsrv01_tcp; SERVICE=ids9tcp2; PROTOCOL=onsoctcp; CLIENT_LOCALE=en_US.CP1252; DB_LOCALE=en_US.819...

Creating a SQLCommand for use in a SQLDataAdapter

I am trying to delete data from a table using a SQLDataAdapter, and to do so I need to give it a DeleteCommand. The SQL I would use to delete a row is: DELETE FROM table WHERE ID = x The problem is thus: How do I specify to the DataAdapter what to replace x with? The SQL to generate the DataAdapter is slightly different (no joins) th...