ado.net

any way to detect a TimeStamp column in a DataTable from SQL Server (fillSchema???)

When updating a datatable from a "select * from sometable", I am iterating the columns in the datatable to dynamically create an update or insert statement, based on datatable.rowstate and DataTable.PrimaryKey. However, I can't seem to find any property that indicates whether a column is a TimeStamp in SQL Server and must therefore be i...

ADO.NET Entity Framework: Update Wizard will not add tables

I added a new ADO.Net Entity Data Model into my project and used the Update Wizard to add tables into the model. Five of the selected tables were added to the design surface. Two other tables will not add. I select them in the wizard and click Finish, yet they never show up on the design surface. Is this a bug, or are there some situ...

Stored procedures with ADO.NET Entity Framework

I'm trying to use a stored procedure in the entity framework. I had the model created initially without the stored proc. I then went into Update Model from Database and selected the stored procedure I wanted and then added it through the function import. Now I can see the function in the model browser under Function Imports but when I t...

Detecting unusable pooled SqlConnections

When I attempt to set an application role on a SqlConnection with sp_setapprole I sometimes get the following error in the Windows event log... The connection has been dropped because the principal that opened it subsequently assumed a new security context, and then tried to reset the connection under its impersonated security contex...

How to deal with datatypes returned by LINQ

I'm new to LINQ, I've used LINQ to SQL to link to two tables, it does return data, which is cool. What I'm trying to understand is what datatype is being returned and how do I work with this datatype? I'm used to dealing with datatables. Are we throwing out datatables (and all the other ADO.Net object like rows, datasets etc.) now if ...

How to bind LINQ data to dropdownlist

The last two lines of this code do not work correctly -- the results are coming back from the LINQ query. I'm just not sure how to successfully bind the indicated columns in the results to the textfield and valuefield of the dropdownlist: protected void BindMarketCodes() { List<lkpMarketCode> mcodesList = new List<lkpMa...

How can I detect condition that causes exception before it happens?

I had no luck with this question so I've produced this simple-as-possible-test-case to demonstrate the problem. In the code below, is it possible to detect that the connection is unusable before trying to use it? SqlConnection c = new SqlConnection(myConnString); c.Open(); // creates pool setAppRole(c); // OK c.Clo...

How do I send a datatable as a parameter to a stored procedure in database

Basically I want to do a innerjoin on "datatable1" which is on the webserver cache to that of another "datatable2" stored in database. I have 2 ways for this 1. I can bring "datatable2" to webserver cache and write a join logic. However this will be very costly and is ruled out. 2. Send "datatable1" to database and do a inner join th...

Maintain a local copy of a table from an external database table, ADO.NET

We have built an application which needs a local copy of a table from another database. I would like to write an ado.net routine which will keep the local table in sync with the master. Using .net 2.0, C# and ADO.NET. Please note I really have no control over the master table which is in a third party, mission critical app I don't wish...

linq to entities inheritance query problem.

I'm trying to perform a linq to entities query on a table that's inherited using Table per Type. The problem I'm having is that I can't get at the properties on the Inhertied table only the properties on the Base Table. var qry = from i in _DB.BaseTable where i is catalogueModel.InheritedTable // Field Doesn't Exist // && i.InheritedTa...

C Sharp : Arguments to pass in ado.net recordset.

Hi, I am trying to execute a codeline similar to the following rs3 = cn2.Execute(strsql); but i guess in c# i have to pass some arguments ato exceute the strsql. Can someone enlighten me on this topic. Thankyou ...

Copy from one database table to another C#

Using C# (vs2005) I need to copy a table from one database to another. Both database engines are MS SQL 2005. For the remote database, the source, I only have execute access to a sproc (stored procedure) to get the data I need to bring locally. The local database I have more control over as it's used by the [asp.net] application whic...

Function Imports in Entity Model with a non-Entity Return Type

I have a stored procedure in my Entity Data Model and added it to the function imports. Problem is ... Visual Studio generates the function code in the model's code-behind if and only if I specify the return to be an entity type. Scalar and null return types do not work. Visual Studio does not generate the function code when I choose ...

ODP.NET OracleCommandBuilder.DeriveParameters for 9i

I have Oracle9i Release 2 ODAC installed and we are migrating from Microsoft .NET Data Provider for Oracle. We have some SqlCommand caching implemented, that uses System.Data.SqlCommandBuilder.DeriveParameters(result) (var result is type of SqlCommand), but there is no DeriveParameters() method until ODP.NET version 10. Perhaps anyone ...

ASP.NET - No Datakey on Gridview RowDeleting event!

I have a GridView just like this: <asp:GridView ID="gvwStudents" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" ShowHeader="False" onrowdeleting="gvwStudents_RowDeleting"> <Columns> <asp:BoundField DataField="FirstName" /> <asp:BoundField DataField="LastName" /> <asp:BoundField DataFiel...

How can I mark generated methods obsolete?

I'm using a strongly typed DataSet for which manually adding rows will be error prone. I'm providing factory methods to create rows properly. I'd like to guide consumers of my class away from the generated Add*Row methods on the *Table classes. Adding Obsolete attributes to the generated methods would do the trick. Sadly, they would be...

What are the known limitations of ADO.NET entity framework designer?

We just found an issue like, when a foreign key relationship is broken, there is no way to re-establish the link in the designer. Any other such known limitations of Entity Framework designer? ...

How does one loop through DataRow to retrieve set of related columns i.e (Param Name, Param Type, and Param Value)?

I'm working on a Generic Reporting Tool, where each report is represented by a row in Reports table in database. Report row structure: ReportID ReportFileName RepParam1Name RepParam1Type RepParam1Value RepParam2Name RepParam2Type RepParam2Value ... RepParam10 So, I need to retrieve report parameters (N...

Execute a stored procedure in Entity Framework from within an ADO.Net DataService

I am using ADO.Net DataServices to expose an Entity Data Model to Silverlight. The model has a stored procedure that returns void. I want to call this procedure from the Silverlight client. My understanding is that I should add a [WebInvoke] method to the DataService class and use DbCommand to call the stored procedure. Here is my co...

Is it possible to use query parameters to fill the IN keyword

Imagine a table with GUIDs as primary key. I would like to select a few of these rows based on their primary key. I would like to use a query like: SELECT * FROM mytable WHERE id IN ('firstguidhere','secondguidhere'); I am using ADO.NET to query the database, so I would like to use a parametrized query instead of dynamic sql, which wo...