ado.net

How to fill multiple types of Business Objects from a single method?

I have four different Business objects and each calls its corresponding FillBusinessObject method to fill all the individual object properties one by one. Now I wish to create a common method which should be able to fill each type of business object. I've created a base class from which all business objects inherit but I am not able to f...

Any advantages from using WCF Data Services in ASP.NET web applications?

If I am creating web applications using ASP.NET and Silverlight is nowhere in the future and there's no need to expose data to third party services (eg, no oData needed), are there any advantages of using WCF Data Services over the traditional ADO.NET methods we've been using over the years? ...

(DevForce vs OpenAccess vs LLBLGen) vs Entity Framework 4 & CTP4

Putting free open source ORM/DataAccess/Modeling tools (like NHibernate) aside, what do some similar commercial tools offer beyond what the current Entity Framework 4 (plus CTP4) offers. Commercial ones in mind are Telerik's OpenAccess, IdeaBlade's DevForce and LLBLGen Pro. Instead of asking separate question per product, I have them a...

Problems with huge CPU overhead

I'm writing an application in vb.net 2005. The app reads a spreadsheet into a DataSet with ADO.NET and uses a column of that table to populate a ListBox. When a ListBox Item is selected, the user will be presented with detailed information on the selected record. One part of this information isn't in the DataSet. I have to compare a col...

Compilied queries with return anonymous type.

Hello, Is it possible to return anonymous type from compiledQuery in linq to entity framework. If yes can you please post solution sample. Thanks Venkat ...

insert problem in C#, using sqlcommand

when I run this sql: insert into table1(ID,Name) values ('10','Saeed'); it seems that the record has been inserted, and if I read the table using (select * from table1) it shows me the inserted record, but after closing the program, it disappears. it's the code: string constr="Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirector...

How do I access an Excel named table via ADO/ODBC?

I have a workbook with multiple sheets, and have created Named Tables (NOT ranges) in the work book. For illustrative purposes, these table names are tblA, tblB, and tblC. I am unable to find a way to query these tables via ADO or ODBC. I can access named ranges, but this will not work for my needs. Thanks! ...

save DataTable to database

Hi, I am generating a DataTable from a webservice and i would like to save the whole DataTable into one database table. DataTable ds = //get info from webservice The DataTable is getting generated but What to do next .I am getting stuck .Show me some syntax.I dont really need the select statement there either, i just want to insert al...

How to return as little rows as possible from related table

Hello, I am new to ADO.net and have this problem: Let's assume I have these two tables in a SQL Server 2005 database, with these columns: [Orders] OrderID OrderDate ShopID TotalAmount TotalTaxAmount etc... [OrdersDetails] OrderID ShopID ItemID Quantity Amount TaxAmount etc I have started a WinForms application to get myself st...

How do I find which rows have been updated in the underlying Datatable on updating the Datagridview?

This is what I am trying to achieve : 1)DataTable populated using data from non database source 2)This table is bound to a DataGridView using BindingSource 3)The DataGridView is updated by the user, so that some cells now have new values. 4)Because the table is bound to the datagridview its values are updated. How do i get only the updat...

DateTime.ParseExact format error

Hi I have used a textbox to store a date in DD-MM-YYYY format and since i use SQL server i used to get the value from the textbox and then place it in a variable of type DateTime dt DateTime dt = DateTime.ParseExact(TextBox10.Text,"MM-DD-YYYY",CultureInfo.InvariantCulture); I am getting format specification error, I went through many ...

Are exceptions thrown reliably when using Ado.Net stored procedures?

If I try and call a stored procedure and there is a database error, will that raise as an exception in my C# code? Or do I need to check the result of the stored procedure and raise an exception myself? Eg: using (SqlCommand cmd = new SqlCommand("prc_InsertSomething", conn)) { if (cmd.ExecuteNonQuery() != 1) // should I be doing th...

Best practice? open and close multi connections, or one large open connection for ado.net

I am using ADO.Net for some database connectivity and I was just hoping I was doing it the right way. I am opening and closing multiple connections for each stored procedure. Or should I be wrapping this up in just one open connection (less resource on the database maybe?) thanks, and if there is anything odd or something I could be do...

ADO.net Connection Pooling

In the code below, the Provider object only has one instance of a DbConnection. Each reader will reference the same connection instance. According to the Microsoft documentation, the second reader will get a second connection from the connection pool. This works correctly. using (var reader1 as IDataReader = Provider.GetReader(sqlStatem...

How closely is Entity Framework tied to WCF RIA Services?

I'm trying to build a simple proof-of-concept "business application" in Silverlight and I keep running into a wall in trying to get data in and out of the database. I'm currently trying to learn WCF RIA Services, but I'm stuck because I can't get Entity Framework to work with existing tables in my database (they don't show up in the mod...

Add/modify SQL table

Trying to determine best way to code this requirement : Need to insert rows to a SQL table having a multiple key index (PlantID,Year,Month). Row may already exist could update or delete existing row. Row contains around 150 fields that is dirived form other SQL tables. Trying to determine simplest way to accomplish , I have thought w...

Best practice for User Control Data Binding - How to achieve this?

Hi folks, I've got an User Control with TextBoxes, Labels, ... . Now I would like to get the same Data Binding Features like I would place the Controls directly on the Form. I tried with an extra Binding Source and Error Provider in the User Control and I tried to make the Properties of my Controls available as an property. Nothing wor...

How can I find all table constraints with a c# script?

I'm in the midst of writing a script that is updating the collation of all varchar columns for every table in my database (Sql Server 2008). I need a way to collect a list of each constraint in a table so that I can drop it, alter the columns the constraint affects, and then re-add the constraint. I know that I am able to grab UK constra...

DataTable.Select using the IN operator

I've never found an elegant way to do this, so I'm wondering what methods other developers prefer (for performance, readability, etc). Is there a way to use the LIKE operator in the DataTable.Select() function, based on the results of a query to another DataTable. For example, in SQL Server, the syntax would be: Select SomeValue From...

How do you use GetSchema(), ReportSchema() or SMO to determine the method a constraint was created in Sql Server 2008?

In this previous question I asked I found that constraints created with Create Index do not exist in sys.objects. I'm already using ReportSchema() and looping through Indexes and IndexColumns collections. Is there a way to determine the method a constraint was created by using the collections available to GetSchema() or ReportSchema()...