コード例 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            LoginParams cd = new LoginParams();

            cd.Name         = TextBox1.Text;
            cd.PassWordFist = TextBox2.Text;

            DL.Class1 obj    = new DL.Class1();
            int       result = obj.ExecuteLogin(cd);

            if (result == 1)
            {
                Response.Redirect("");
            }
        }
コード例 #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DL.Class1 cls = new DL.Class1();
            //DataSet dtResult = cls.Executesearch(TextBox1.Text);
            //dgvResult.DataSource = dtResult.Tables[0];
            //dgvResult.DataBind();

            using (SqlConnection sqlcon = new SqlConnection())
            {
                sqlcon.ConnectionString = cls.GetConnetionString();
                sqlcon.Open();

                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = sqlcon;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "search";
                    cmd.Parameters.AddWithValue("@Name", TextBox1.Text);
                    SqlDataReader reader = cmd.ExecuteReader();
                    dgvResult.DataSource = reader;
                    dgvResult.DataBind();
                }
            }
        }