public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { // string strcon = ConfigurationManager.ConnectionStrings["strcon"].ConnectionString; string strcon="Data Source=192.168.1.36,1433;Network Library=DBMSSOCN;Initial Catalog=TracNghiem;Integrated Security=true;"; // string strcon = "Server=.\\SQLEXPRESS;Database=TracNghiem;Integrated Security=true;"; SqlConnection con; try { con = new SqlConnection(strcon); con.Open(); MessageBox.Show("Connected Successfully"); } catch(Exception xe) { MessageBox.Show("Error\n" + xe.Message); } } private void button2_Click(object sender, EventArgs e) { Application.Exit(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)