Beispiel #1
0
        private void EnterBtn_Click(object sender, EventArgs e)
        {
            //Pull and save the entered data
            string fName    = fNameTxt.ToString();
            string lName    = lNameTxt.ToString();
            string userN    = userNameTxt.ToString();
            string email    = emailTxt.ToString();
            string password = passwordTxtBox.ToString();

            //validate the entered data

            //Connect to database to enter data
            string        connectionString;
            SqlConnection cnn;

            connectionString = @"Data Source=Cita450.Project.Pankow;
            Initial Catalog=Users;
            integrated security info=False;
                persist security info=False;
                Trusted_Connection=Yes";
            cnn = new SqlConnection(connectionString);
            cnn.Open();
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("SELECT * FROM Customer", cnn);

            //display users entered
            DataSet dataSet = new DataSet();

            sqlDataAdapter.Fill(dataSet, "Employees");
            DataGrid1.DataSource = dataSet.Tables["Employees"].DefaultView;
            DataGrid1.Show();
            MessageBox.Show("Connection Open!");
            cnn.Close();
        }