sqlclient

TDS Error on Azure Entity Framework SQL Calls after Windows 10 April 2018 Update [duplicate]

痴心易碎 提交于 2019-12-06 02:27:08
This question already has answers here : SqlClient error after updating Windows - “The incoming tabular data stream (TDS) remote procedure call > (RPC) protocol stream is incorrect” (5 answers) Closed last year . I have the following C# code that executes against a SQL Server hosted in Azure. protected IQueryable<T> FilterUpdatedRows<T>(IQueryable<T> query, DateTime lastSyncTimestamp) where T: class, ITimestamp { return query.Where(x => x.InsertTimestamp >= lastSyncTimestamp || (x.UpdateTimestamp.HasValue && x.UpdateTimestamp >= lastSyncTimestamp)); } The Generic (T) are Entity Framework

Intermittent System.IndexOutOfRangeException when reading a field from IDataReader

那年仲夏 提交于 2019-12-05 17:58:14
I have a very weird problem in code that I would not expect to ever fail. It is a website with some traffic but not that huge based on AspDotNetStoreFront. Site intermittently crashes when trying to read a database field from a reader. This happen on various places on the website. An example of such code is below on the line with object pValue = rs["PropertyValueString"]; private Dictionary<string, object> GetPropertValuePairs(string userName) { string query = string.Format("select PropertyName, PropertyValueString from dbo.profile with(nolock) where CustomerGUID = {0} and StoreID = {1}", DB

C# Update Table using SqlCommand.Parameters

≡放荡痞女 提交于 2019-12-05 11:20:32
I'm trying to update an MSSQL table using SqlCommand, I think it's a syntax error with my T-SQL, but here is what I have so far: SqlCommand sqlCmd = new SqlCommand("UPDATE yak_tickets SET email = @emailParam, subject = @subjectParam, text = @textParam, statusid = @statusIDParam, ticketClass = @ticketClassParam WHERE id = @ticketIDParam", sqlConn); The parameters are working as they should, however, the table never gets updated when I run the code. Any help would be appreciated =) Here is the rest of the code: #region Parameters /* Parameters */ sqlCmd.Parameters.Add("@ticketIDParam", SqlDbType

System.Data.IDbCommand and asynchronous execution?

泪湿孤枕 提交于 2019-12-05 01:21:39
System.Data.SqlClient.SqlCommand has methods BeginExecuteNonQuery BeginExecuteReader BeginExecuteXmlReader and EndExecuteNonQuery EndExecuteReader EndExecuteXmlReader for asynchronous execution. System.Data.IDbCommand only has ExecuteNonQuery ExecuteReader ExecuteXmlReader which are for synchronous operations only. Is there any interface for asynchronous operations ? In addition, why is there no BeginExecuteScalar ? IDbCommand does not have the begin/end async methods because they did not yet exist in the original .NET 1.1 release of ADO.NET, and when the async methods were added in .NET 2.0

System.Data.EntityException: The underlying provider failed on Commit

大憨熊 提交于 2019-12-03 19:51:14
问题 Using Entity Framework, I received a number of the following exceptions last night in one of my applications: System.Data.EntityException: The underlying provider failed on Commit. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser

Populate checkboxlist with items from database?

荒凉一梦 提交于 2019-12-03 16:43:00
Ok, so I want to populate/bind some data to a checkboxlist but cannot seem to binf the right values? I want to populate it with the information from a ROW, not the whole column which is what's happening to me. Here's some code anyways to show you what the problem is. This is the code in the xaml <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [Option1], [Option2], [Option3] FROM [Questions] WHERE ([QuestionID] = @QuestionID)"> <SelectParameters> <asp:Parameter

I can't connect to SQL Server database with C# code [closed]

放肆的年华 提交于 2019-12-02 13:04:22
I was trying to create registration form but when I run my project am getting this error message Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll My code: using System; using System.Data; using System.Data.SqlClient; namespace Registration{ private void Register_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=SHAB SQLEXPRESS;InitialCatalog=Phonebook;Integrated Security=True"); SqlCommand cmd = new SqlCommand(@"INSERT INTO [dbo].[registration]([username[fullname],[Password]) VALUES('" + username.Text+"', '"+fullname.Text+"', '"

SqlDataReader hangs on GetValue() method and SNIReadSyncOverAsync

寵の児 提交于 2019-12-02 11:34:16
问题 We have an extremely weird problem at hand. The .Net SqlDataReader object gets stuck while reading a value on GetValue() method. There are no exceptions and it does not timeout for at least more than 10 minutes which is really long time. After more than 10 minutes, it throws this error: General Exception - !ET:SqlException{CRLF}!M:Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.{CRLF}General Exception - !ET:Win32Exception{CRLF}

Scope_identity() in batched sqlclient commands

孤街浪徒 提交于 2019-12-02 06:25:22
I usually use a stored procedure when inserting records to make sure I get the correct scope_identity() value. I have a requirement to get the id field of an inserted record when using SqlClient now. My understanding is that if I batch the scope_identity() command with the insert then it will still be in the same scope as the insert command? Something like below. Hard to verify though... Will I 100% get the correct id value with this..? (id field is an auto-incrementing bigint - Sql Server) long newid = 0; using (SqlConnection conn = new SqlConnection(....)) { conn.Open(); using (SqlCommand

SqlDataReader hangs on GetValue() method and SNIReadSyncOverAsync

我是研究僧i 提交于 2019-12-02 06:23:08
We have an extremely weird problem at hand. The .Net SqlDataReader object gets stuck while reading a value on GetValue() method. There are no exceptions and it does not timeout for at least more than 10 minutes which is really long time. After more than 10 minutes, it throws this error: General Exception - !ET:SqlException{CRLF}!M:Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.{CRLF}General Exception - !ET:Win32Exception{CRLF}!M:The wait operation timed out{CRLF}! Stack trace obtained through process dump. 000000001b2ee6f8