示例#1
0
    public List <clsJBuku> TampilData(string xNmJenis)
    {
        using (SqlConnection conn = new SqlConnection(StrConn))
        {
            string          Query   = "SELECT*FROM Jenis WHERE NmJenis LIKE '%" + xNmJenis + "%'";
            List <clsJBuku> tmpBaca = new List <clsJBuku>();
            SqlCommand      cmd     = new SqlCommand(Query, conn);

            SqlDataReader reader;
            conn.Open();
            reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    clsJBuku objTemp = new clsJBuku();
                    objTemp.FKdJenis = reader["KdJenis"].ToString();
                    objTemp.FNmJenis = reader["NmJenis"].ToString();
                    tmpBaca.Add(objTemp);
                }
            }
            return(tmpBaca);
        }
    }