Note that there are some explanatory texts on larger screens.

plurals
  1. POTCP/IP Connection
    primarykey
    data
    text
    <p>I have been trying and searched thousands of times in other sites but never found a sample or simple code to use.</p> <p>I've created an application C# which uses an ODBC connection, i have also MS SQL installed and configured to enable remoting database information sharing. I want to make my database available to everyone uses this application i have made by using a connection. </p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace CaseMatter { public partial class mainLog : Form { string userID, userName, userAddress, userFName, userLastName, userCity, userPassword, userTele; public mainLog() { InitializeComponent(); this.Size = new Size(442, 162); } private void Submitbtn_Click(object sender, EventArgs e) { string ConnectionString = "Data Source=xx.xx.xx.xx,1433;Initial Catalog=master;Integrated Security=SSPI;"; var conn = new SqlConnection(ConnectionString); conn.Open(); var strSQLCommand = "SELECT Name FROM example WHERE id='1'"; var command = new SqlCommand(strSQLCommand, conn); var reader = command.ExecuteReader(); while (reader.Read()) { passwordBox.Text = reader.GetString(0); } reader.Close(); conn.Close(); } } </code></pre> <p>}</p> <p>I have just edited the code and tried it, i have added a try catch to handle sql exceptions but it still freezes when i click on submit button.</p> <p>Hopefully someone figures this out. ERROR: "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)"</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload