[Solved] Why is the SqlConnection with Textbox not working?
[ad_1] you cannot set connection string using text box outside the event.you can use connection string in form_load event or button_click event like below using System.Data.SqlClient; private void Form1_Load(object sender, EventArgs e) { SqlConnection con; con = new SqlConnection(@”Data Source=” + textBox1.Text + “;Initial Catalog=DBName;user ID=sa;Password=yourpassword”); con.Open(); } 1 [ad_2] solved Why is the SqlConnection … Read more