Quote:A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Windows.Forms; using System.Data.Odbc; namespace WebApp1 { public partial class Test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { using (SqlConnection cnct = new SqlConnection("Server=x.x.x.x;User ID=xx;Password=xx;Database=xx;")) { try { cnct.Open(); using (SqlCommand cmd = new SqlCommand("select codcli from client", cnct)) { SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { string code = rdr.GetString(1); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } }
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="WebApp1.Test" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <asp:Repeater ID="repeater" runat="server"> <HeaderTemplate> </HeaderTemplate> <itemtemplate> <table><tbody><tr class="Header"> <td>Code</td> </tr><tr> <td> <%# Eval("code") %> </td> </tr> </tbody></table> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)