ado.net

What makes The ADO.NET Entity Framework different than other ORM in the market?

The question header is clear, i want to know why its different and why, when to select it for my project? ...

BindingSource's and DataGridView's

Hey Stackers, I have two DataGridView's bound to an underlying DataSource through BindingSources and TableAdapaters. I have two models; strings and tables. Tables -> [id, handle, description] Strings -> [id, handle, table_id] So there's a many-to-one between Tables and Strings. What's the easiest way to make the selection of the "t...

How to write a database class that supports parameterized queries

I'm a former classic ASP programmer and sometimes PHP programmer writing my first ASP.NET application. I'm loving the much-improved ADO.NET functions, but I'm feeling the need to write a database class. Partly I want to consolidate the code that actually interacts with the database, and partly I want to reduce what feels like repetition....

How do I add relational data to an ASP.net MVC data entity Create view?

Let's say I have a table of staff members, and a separate table of staff roles in a many-to-many relationship (ie, with a StaffMembersInRoles table in between). Using the ADO.net entity framework we have an object model like this: I have a StaffController controller with a create method and a Create view which is pretty much the standa...

Code Review: ADO.NET Data Access Utility Class (VB)

When I started at my current employer I inherited a project from a previous developer and in that project was a data access utility class that tries to simplify a lot of the code involved in making calls and retrieving data back from the database. Over time it has been modified to add more overloaded forms of functions, and now I am look...

SQL scripts act on master database instead of practice database

I wrote some sql scripts to create a database and store data. I just noticed that the new tables and data are going to the master database. I found that I can address the correct database if I scope out the database as so: CREATE TABLE Practice1.dbo.Experiments ( ID int IDENTITY (100,1) PRIMARY KEY, CompanyName nvarchar ...

Update linked tables in MS Access Database with C# programatically

I have two Access 2003 databases (fooDb and barDb). There are four tables in fooDb that are linked to tables in barDb. Two questions: How do I update the table contents (linked tables in fooDb should be synchronized with the table contents in barDb) How do I re-link the table to a different barDb using ADO.NET I googled but didn't g...

SubSonic.Query vs SubSonic.SqlQuery

I've been using SubSonic.Query all these while, until one day when I can't do "IS NULL" by adding WHERE, then I realized that SubSonic.SqlQuery existed and it has a function of "IsNull()". After checking out the source code, Query and SqlQuery is not inherited in any way, so what's their major difference and how to decide which to use? ...

"Visual studio 2008 SP1" ADO.NET Entity Data Model template not found

Hi! I have installed Visual Studio Team System 2008 Architecture version: 9.0.30729.1 SP and Microsoft Net Framework 3.5 SP1. When I'm going to add a new item I can't find ADO.NET Entity Data Model template. What's happening? Thanks! ...

Effcient updates of ado.net typed dataset row

Does Ado.net check if the following update is required? ADDRESS table with a TOWN column, for example. Retrieve a ADDRESS row that has a TOWN value of "Leeds" In update code ADDRESS.TOWN gets set to "Leeds" , i.e. Its not actually changed. We have called Set methods or assignments so RowState gets changed to modified. Does the ada...

Correct way to have a DataGridView visually reflect changes in its DataSource

Say a DataGridView has its DataSource property set to a DataView instance. DataGridView dgv; DataTable dt; // ... dt gets populated. DataView dv = dt.DefaultView; dgv.DataSource = dv; // ... dt gets modified // The DataGridView needs to update to show these changes visually // What goes here? I know you could set dgv.DataSource t...

Explicitly handle or create the data object that’s bound to the control

hi, I read somewhere that one of few weaknesses in data binding model is that you never explicitly handle or create the data object that’s bound to the control and as a result you don’t have a chance to add an extra item. But I’m not sure what is meant by that. What or how exactly would you be able to add an extra item if you were allo...

Does SqlDataSource automatically convert parameter value…?

hi 1) ObjectDataSource doesn’t check the type of a supplied parameter, but instead attempts to convert the parameter value into the data type of a matching parameter. Is that also true for SqlDatasource? thanx ...

Refresh schema won't retrieve columns

hi Can you give me some advice on how to enable refresh schema so I can use it to (re)generate GridView columns: With ObjectDataSource controls refresh schema link works ( thus retrieves information from data source ) only when I change a property in a data source ( for example, if I make public property into private one ) and then re...

Cancelling Aysnchronous stored procedure

Hello All, I am running a long running stored procedure that user can cancel. I am using Backgroundworker component along with BeginExecuteReader method of ado.net everything seems to work fine, but even when i cancel the stored procedure, the database is still running the proc Is there a way to cancel the actual job on the database ...

Detecting command cancel in asynchronous BeginExecuteReader

Hello, I am having an asynchronous call to beingexecutereader method of sql command, that a user can cancel. When cancel happens, i cancel the sqlcommand object, and this would kill the executing job on sql server. However as soon as i cancel it, the callback method specified in the BeginExecute query is called, and it errors out when ...

CommandType.Text vs CommandType.StoredProcedure

Is there any benefit to explicitly using the StoredProcedure CommandType as opposed to just using a Text Command? In other words, is cmd = new SqlCommand("EXEC StoredProc(@p1, @p2)"); cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@p1", 1); cmd.Parameters.Add("@p2", 2); any worse than cmd = new SqlCommand("StoredProc"); cmd...

Strange result return from sql server

Hello everybody, I am working on my project and having strange result with asp.net C# and stored procedure that returns scalar variable. In short, I am trying to return user name, however I get only the first letter from the name, which is strange. I went trough the code couple dozen of times; however i still cannot find the error. I w...

How to do "select count(*)" on ADO.NET Entity Framework

Hello! How can I do a "select count(*)" using ADO.NET Entity Framework? Thanks! ...

How can I use MS Access as a provider for ADO.NET entity framework ?

Hi, Do you know to use a provider for MS Access in ADO.NET Entity Framework? ...