Ejemplo n.º 1
0
        private void btnTestConnect_Click(object sender, EventArgs e)
        {
            string SQLServer = txtSQLServer.Text;

            if (!validateTestCon())
            {
                MessageBox.Show("Please fill SQL Server or username, password");
            }
            if (chbWindowAuth.Checked)
            {
                connector = new SQLConnector(SQLServer);
            }
            else
            {
                connector = new SQLConnector(SQLServer, txtUserName.Text, txtPassWord.Text);
            }

            if (!connector.CheckConnection())
            {
                MessageBox.Show("Please check your information filled");
                btnTestConnect.Text = "Test Connection";
                return;
            }
            DataTable catelog = connector.GetCatalogList();

            txtCatalog.DataSource    = catelog;
            txtCatalog.DisplayMember = "name";
            txtCatalog.Enabled       = true;
        }
Ejemplo n.º 2
0
        private void btnTestConnect_Click(object sender, EventArgs e)
        {
            string SQLServer = "DESKTOP-GR8RADT\\SQLEXPRESS";

            connector = new SQLConnector(SQLServer);

            DataTable catelog = connector.GetCatalogList();

            cbxCatalog.DataSource    = catelog;
            cbxCatalog.DisplayMember = "name";
            cbxCatalog.Enabled       = true;
            //using(var db = new MiniBookStoreEntities())
            //{
            //    Debug.WriteLine("vao day");

            //    var data = db.Company;
            //    foreach(var c in data)
            //    {
            //        Debug.WriteLine(c.Company_ID);
            //    }
            //    Debug.WriteLine("End loop");
            //    Company a = new Company { Company_Name = "quitest" };
            //    db.Company.AddObject(a);
            //    db.SaveChanges();
            //    Debug.WriteLine("End save");
            //}
        }