ado.net

LINQ-SQL & ADO.NET - How to make a bulk transaction entirely asynchronous?

强颜欢笑 提交于 2020-01-06 07:12:07
问题 So i'm dealing with an ASP.NET 4.0 Web Forms Application in which the DAL is built with a combination of LINQ-SQL and classic ADO.NET (for auditing transactions, and bulk updates). I have an admin page on the site which performs an update on a bunch of records (could be thousands), and not to mention there is T-SQL triggers in place on those records. Needless to say, its a killer of an update. So of course, the page is timing out. The update transaction is performing with the following code:

Can a stateless WCF service benefit from built-in database connection pooling?

岁酱吖の 提交于 2020-01-05 17:04:13
问题 I understand that a typical .NET application that accesses a(n SQL Server) database doesn't have to do anything in particular in order to benefit from the connection pooling. Even if an application repeatedly opens and closes database connections, they do get pooled by the framework (assuming that things such as credentials do not change from call to call). My usage scenario seems to be a bit different. When my service gets instantiated, it opens a database connection once, does some work,

Can a stateless WCF service benefit from built-in database connection pooling?

喜欢而已 提交于 2020-01-05 17:01:53
问题 I understand that a typical .NET application that accesses a(n SQL Server) database doesn't have to do anything in particular in order to benefit from the connection pooling. Even if an application repeatedly opens and closes database connections, they do get pooled by the framework (assuming that things such as credentials do not change from call to call). My usage scenario seems to be a bit different. When my service gets instantiated, it opens a database connection once, does some work,

How to achieve functionlity i.e. controlling “Incr Pool Size” or “Decr Pool Size” while establishing connection to SQL? similar to ORACLE

家住魔仙堡 提交于 2020-01-05 08:38:27
问题 I have asked a question about "Incr Pool Size" or "Decr Pool Size" How to resolve SqlConnection error "Keyword not supported: 'decr pool size'." This is another but different question related to that , in brief ORACLE connection string provides these two option to increase/decrease connection objects when connection pool is empty or full respectively. how can we achieve this with SQL. EDIT: Why I want to know because I am creating a middleware where I am writing to database using multiple

How can I create two commands in one connection?

三世轮回 提交于 2020-01-05 08:17:13
问题 For example I want to INSERT data in database and also UPDATE another table. My code is like this SqlConnection con = new SqlConnection("**"); con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandText = "INSERT Borrowbook VALUES (@StudentID, @ISBN, @Title, @Date)"; SqlParameter p1 = new SqlParameter("@StudentID", SqlDbType.NChar); p1.Value = textBox2.Text; cmd.Parameters.Add(p1); SqlParameter p2 = new SqlParameter("@ISBN", SqlDbType.NVarChar); p2.Value = textBox4.Text; cmd.Parameters

Create custom DataTable which is bindable to WinForms controls?

喜夏-厌秋 提交于 2020-01-05 07:58:11
问题 Our shop primarily use "ADO objects" (I'm referring to DataSet , DataTable , and DataRow ) for marshaling around data and manipulating it on forms and in grids. We are experimenting with creating shop-flavored counterparts to the native ADO objects so that we can impose our in-house standards on top of them. Implementing this is straightforward with one exception: I want our objects to be bindable to controls. I'm aware of IList, IBindingList, BindingSource, etc. and have looked at and

Serializing fields in a custom DataSet to XML

坚强是说给别人听的谎言 提交于 2020-01-05 06:52:07
问题 Is there any way to add fields to a DataSet which will be serialized along with the table information when the DataSet is serialized in XML? I have some information that describes the DataSet that I want to try to include inside it when I throw it around in XML. I've tried adding fields and classes in the partial class Visual Studio generates for you for validation methods but I can't seem to get them to show up alongside the table information in the XML file either when myDataSet.WriteXML()

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine error in windows server

假如想象 提交于 2020-01-05 05:46:10
问题 I am using a excel reader to read contents from the excel, string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + filePath + ";Extended Properties=Excel 12.0;"; System.Data.OleDb.OleDbConnection ExcelConnection = new System.Data.OleDb.OleDbConnection(connectionString); I'm working in VS2010 on a windows 7 ultimate x64 installation. it works fine in my local machine when I run with VS. When I upload the website in server I get the following error. What should I do here,

How to track which row update failed in batch update

好久不见. 提交于 2020-01-05 05:45:10
问题 I'm using a try catch blocks to do a batch update using ADO.NET2.0, the UpdateBatchSize is set 500, I can often catch exceptions, but I don't know which row update failed, is there a way to get the actual failed row? 回答1: You can use event RowUpdated to get the reference of row: yourAdapter.RowUpdated += OnRowUpdated; Then: protected static void OnRowUpdated(object sender, SqlRowUpdatedEventArgs args) { if (args.Status == UpdateStatus.ErrorsOccurred) { // Reference to row which throws error

C# Edit row in SQL

心已入冬 提交于 2020-01-05 05:27:12
问题 I got some issues with my code. This is my method in my Database class public void editproduct(string a, int b, int c) { conn.Open(); SqlCommand command = new SqlCommand("UPDATE Productdescription SET pdescription = '" + a + "',Price = " + b + " WHERE pid = " + c + ")", conn); command.ExecuteNonQuery(); conn.Close(); } I try to execute it here with my button. private void button1_Click(object sender, EventArgs e) { Database db = new Database(); db.editproduct(textBox1.Text, Convert.ToInt32