Beispiel #1
0
        private Boolean SaveData()
        {
            SqlConnection conn;
            SqlCommand    command;
            string        sql;
            DataSet       ds;

            class_is.dbconfig db = new class_is.dbconfig();
            //config = db.config();
            conn = new SqlConnection(db.config());
            sql  = "INSERT INTO [IS].[dbo].[USER] ";
            sql += "(USER_NAME,PASSWORD,USER_GROUP,LINE_ID,FIRST_NAME,LAST_NAME,USER_CODE,DEPARTMENT,EMAIL) ";
            sql += "VALUES ( ";
            sql += "'" + txtUserName.Text + "'";
            sql += "'Password'";
            sql += "'" + ddlGroup.SelectedValue + "'";
            sql += "'" + txtLine.Text + "'";
            sql += "'" + txtFName.Text + "'";
            sql += "'" + txtLName.Text + "'";
            sql += "'" + txtEmpID.Text + "'";
            sql += "'" + ddlDep.SelectedValue + "'";
            sql += "'" + txtEmail.Text + "'";
            sql += ")";
            if (db.ExecuteSQL(sql))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        private void GetUserGroup()
        {
            DataSet    ds = new DataSet();
            string     sql;
            int        i;
            int        count;
            string     GroupID, GroupName;
            SqlCommand cmd;
            ListItem   li;

            class_is.dbconfig db   = new class_is.dbconfig();
            SqlConnection     conn = new SqlConnection(db.config());
            SqlDataAdapter    data;

            conn.Open();
            sql  = "select * ";
            sql += "from [IS].[dbo].[UserGroup] ";
            cmd  = new SqlCommand(sql);
            data = new SqlDataAdapter(sql, conn);
            data.Fill(ds);
            count = ds.Tables[0].Rows.Count;
            for (i = 0; i <= count - 1; i++)
            {
                GroupID   = ds.Tables[0].Rows[i]["GroupID"].ToString();
                GroupName = ds.Tables[0].Rows[i]["GroupName"].ToString();
                li        = new ListItem(GroupName, GroupID);
                ddlGroup.Items.Add(li);
            }
            conn.Close();
        }